pmt: initial 2.6.0 update
This commit is contained in:
199
out/Makefile
199
out/Makefile
@@ -25,102 +25,127 @@ include ../Makefile.inc
|
||||
-include $(BUILD)/config/INS_STAT.mk
|
||||
-include $(BUILD)/config/UNINS_STAT.mk
|
||||
|
||||
INSTALL_PROGRESS_LIST := \
|
||||
really_termux \
|
||||
welcome \
|
||||
check_ins_stat \
|
||||
deb_installer \
|
||||
really_builded \
|
||||
install_binary
|
||||
|
||||
UNINSTALL_PROGRESS_LIST := \
|
||||
really_termux \
|
||||
welcome \
|
||||
check_unins_stat \
|
||||
uninstall_$(TARGET)
|
||||
|
||||
# create an empty target
|
||||
all:
|
||||
$(hide)printf ""
|
||||
$(P) ""
|
||||
|
||||
# installer
|
||||
.PHONY: install
|
||||
install:
|
||||
# really termux?
|
||||
$(hide)if [ -f $(TERMUX_BIN)/termux-open ]; then \
|
||||
printf " ------------ $(TARGET) installer ------------ \n"; \
|
||||
if [ -f $(TERMUX_BIN)/$(TARGET) ]; then \
|
||||
printf " - $(TARGET) already installed\n"; \
|
||||
exit; \
|
||||
fi; \
|
||||
if [ ! "$(INSTALL_SUCCESS)" = "true" ] && [ ! "$(INSTALL_SUCCESS)" = "" ]; then \
|
||||
printf " - $(YELLOW)$(BOLD)Warning:$(BOLD_RESET)$(RESET) a previously-stayed failed installation process found\n"; \
|
||||
fi; \
|
||||
if [ -f $(DEB_DIR)/*.deb ]; then \
|
||||
printf " - The created deb pack was found. It's setup...\n"; \
|
||||
cd $(DEB_DIR) || exit 1; \
|
||||
apt install ./*.deb || exit 1; \
|
||||
if [ ! "$?" = "0" ]; then \
|
||||
cd $(CUR_DIR); \
|
||||
printf " - Success.\n\n"; \
|
||||
echo "INSTALL_SUCCESS := true" > $(BUILD)/config/INS_STAT.mk; \
|
||||
echo "UNINSTALLED_SUCCESS := " > $(BUILD)/config/UNINS_STAT.mk; \
|
||||
cd ..; \
|
||||
exit 0; \
|
||||
else \
|
||||
cd $(CUR_DIR); \
|
||||
printf " - $(RED)$(BOLD)Error:$(BOLD_RESET)$(RESET) installing failed!\n"; \
|
||||
echo "INSTALL_SUCCESS := false" > $(BUILD)/config/INS_STAT.mk; \
|
||||
cd ..; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
fi; \
|
||||
if [ ! -f $(BINARY_DIR)/$(TARGET) ]; then \
|
||||
printf " - $(RED)$(BOLD)Error:$(BOLD_RESET)$(RESET) Package not builded! Please build package and try again \n"; \
|
||||
echo "INSTALL_SUCCESS := false" > $(BUILD)/config/INS_STAT.mk; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
printf " - Installing binary...\n"; \
|
||||
if [ "`cp $(BINARY_DIR)/$(TARGET) /data/data/com.termux/files/usr/bin/$(TARGET)`" = "" ]; then \
|
||||
printf " - Setting up permissions...\n"; \
|
||||
else \
|
||||
echo "INSTALL_SUCCESS := false" > $(BUILD)/config/INS_STAT.mk; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
if [ "`chmod 777 $(TERMUX_BIN)/$(TARGET)`" = "" ]; then \
|
||||
printf " - Saving current status...\n"; \
|
||||
echo "INSTALL_SUCCESS := true" > $(BUILD)/config/INS_STAT.mk; \
|
||||
else \
|
||||
echo "INSTALL_SUCCESS := false" > $(BUILD)/config/INS_STAT.mk; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
printf " - Success.\n\n"; \
|
||||
echo "INSTALL_SUCCESS := true" > $(BUILD)/config/INS_STAT.mk; \
|
||||
echo "UNINSTALLED_SUCCESS := " > $(BUILD)/config/UNINS_STAT.mk; \
|
||||
else \
|
||||
printf " - $(RED)$(BOLD)Error:$(BOLD_RESET)$(RESET) This function is only available on Termux.\n"; \
|
||||
exit 1; \
|
||||
fi
|
||||
install: $(INSTALL_PROGRESS_LIST)
|
||||
|
||||
# uninstaller
|
||||
.PHONY: uninstall
|
||||
uninstall:
|
||||
# really termux?
|
||||
$(hide)if [ -f $(TERMUX_BIN)/termux-open ]; then \
|
||||
printf " ----------- $(TARGET) uninstaller ----------- \n"; \
|
||||
if [ ! -f $(TERMUX_BIN)/$(TARGET) ]; then \
|
||||
printf " - $(TARGET) already uninstalled\n"; \
|
||||
exit; \
|
||||
fi; \
|
||||
if [ ! "$(UNINSTALL_SUCCESS)" = "true" ] && [ ! "$(UNINSTALL_SUCCESS)" = "" ]; then \
|
||||
printf " - $(YELLOW)$(BOLD)Warning:$(BOLD_RESET)$(RESET) a previously-stayed failed uninstallation process found\n"; \
|
||||
fi; \
|
||||
if [ -f $(TERMUX_USR)/share/man/man8/$(TARGET).8.gz ]; then \
|
||||
printf " - It was found to be established by $(TARGET)'s deb pack. It's removed with apt...\n"; \
|
||||
apt remove -y $(TARGET) || exit 1; \
|
||||
printf " - Success.\n\n"; \
|
||||
echo "UNINSTALLED_SUCCESS := true" > $(BUILD)/config/UNINS_STAT.mk; \
|
||||
echo "INSTALL_SUCCESS := " > $(BUILD)/config/INS_STAT.mk; \
|
||||
else \
|
||||
printf " - It was found that pmt was manually established (with this makefile or copying). Manually removed...\n"; \
|
||||
if [ "`rm $(TERMUX_BIN)/$(TARGET)`" = "" ]; then \
|
||||
printf " - Success.\n\n"; \
|
||||
echo "UNINSTALLED_SUCCESS := true" > $(BUILD)/config/UNINS_STAT.mk; \
|
||||
echo "INSTALL_SUCCESS := " > $(BUILD)/config/INS_STAT.mk; \
|
||||
else \
|
||||
echo "UNINSTALLED_SUCCESS := false" > $(BUILD)/config/UNINS_STAT.mk; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
fi; \
|
||||
uninstall: $(UNINSTALL_PROGRESS_LIST)
|
||||
|
||||
install_binary:
|
||||
$(E) " - Installing binary..."
|
||||
if cp $(BINARY_DIR)/$(TARGET) /data/data/com.termux/files/usr/bin/$(TARGET); then \
|
||||
$(E_NS) " - Setting up permissions..."; \
|
||||
else \
|
||||
printf "$(RED)$(BOLD)Error:$(BOLD_RESET)$(RESET) This function is only available on Termux.\n"; \
|
||||
$(E_NS) "INSTALL_SUCCESS := false" > $(BUILD)/config/INS_STAT.mk; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
if chmod 777 $(TERMUX_BIN)/$(TARGET); then \
|
||||
$(E_NS) " - Saving current status..."; \
|
||||
$(E_NS) "INSTALL_SUCCESS := true" > $(BUILD)/config/INS_STAT.mk; \
|
||||
else \
|
||||
$(E_NS) "INSTALL_SUCCESS := false" > $(BUILD)/config/INS_STAT.mk; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
$(P) " - Success.\n\n"; \
|
||||
$(E_NS) "INSTALL_SUCCESS := true" > $(BUILD)/config/INS_STAT.mk; \
|
||||
$(E_NS) "UNINSTALLED_SUCCESS := " > $(BUILD)/config/UNINS_STAT.mk; \
|
||||
|
||||
uninstall_$(TARGET):
|
||||
if [ -f $(TERMUX_USR)/share/man/man8/$(TARGET).8.gz ]; then \
|
||||
$(E_NS) " - It was found to be established by $(TARGET)'s deb pack. It's removed with apt..."; \
|
||||
apt remove -y $(TARGET) || exit 1; \
|
||||
$(P) " - Success.\n\n"; \
|
||||
$(E_NS) "UNINSTALLED_SUCCESS := true" > $(BUILD)/config/UNINS_STAT.mk; \
|
||||
$(E_NS) "INSTALL_SUCCESS := " > $(BUILD)/config/INS_STAT.mk; \
|
||||
else \
|
||||
$(E_NS) " - It was found that pmt was manually established (with this makefile or copying). Manually removed..."; \
|
||||
if rm $(TERMUX_BIN)/$(TARGET); then \
|
||||
$(P) " - Success.\n\n"; \
|
||||
$(E_NS) "UNINSTALLED_SUCCESS := true" > $(BUILD)/config/UNINS_STAT.mk; \
|
||||
$(E_NS) "INSTALL_SUCCESS := " > $(BUILD)/config/INS_STAT.mk; \
|
||||
else \
|
||||
$(E_NS) "UNINSTALLED_SUCCESS := false" > $(BUILD)/config/UNINS_STAT.mk; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
fi
|
||||
|
||||
deb_installer:
|
||||
if [ -f $(DEB_DIR)/*.deb ]; then \
|
||||
$(E_NS) " - The created deb pack was found. It's setup..."; \
|
||||
cd $(DEB_DIR) || exit 1; \
|
||||
apt install ./*.deb || exit 1; \
|
||||
if [ ! "$?" = "0" ]; then \
|
||||
cd $(CUR_DIR); \
|
||||
$(P) " - Success.\n\n"; \
|
||||
$(E_NS) "INSTALL_SUCCESS := true" > $(BUILD)/config/INS_STAT.mk; \
|
||||
$(E_NS) "UNINSTALLED_SUCCESS := " > $(BUILD)/config/UNINS_STAT.mk; \
|
||||
cd ..; \
|
||||
exit 0; \
|
||||
else \
|
||||
cd $(CUR_DIR); \
|
||||
$(P) " - $(RED)$(BOLD)Error:$(BOLD_RESET)$(RESET) installing failed!\n"; \
|
||||
$(E_NS) "INSTALL_SUCCESS := false" > $(BUILD)/config/INS_STAT.mk; \
|
||||
cd ..; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
fi
|
||||
|
||||
check_ins_stat:
|
||||
@ if [ ! "$(INSTALL_SUCCESS)" = "true" ] && [ ! "$(INSTALL_SUCCESS)" = "" ]; then \
|
||||
$(P) " - $(YELLOW)$(BOLD)Warning:$(BOLD_RESET)$(RESET) a previously-stayed failed installation process found\n"; \
|
||||
fi
|
||||
|
||||
check_unins_stat:
|
||||
@ if [ ! "$(UNINSTALL_SUCCESS)" = "true" ] && [ ! "$(UNINSTALL_SUCCESS)" = "" ]; then \
|
||||
$(P) " - $(YELLOW)$(BOLD)Warning:$(BOLD_RESET)$(RESET) a previously-stayed failed uninstallation process found\n"; \
|
||||
fi
|
||||
|
||||
welcome:
|
||||
$(E) " ----------- $(TARGET) $(PROG)er ----------- "
|
||||
@ if [ "$(PROG)" = "uninstall" ]; then \
|
||||
if [ ! -f $(TERMUX_BIN)/$(TARGET) ]; then \
|
||||
$(E_NS) " - $(TARGET) already $(PROG)ed"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
fi
|
||||
@ if [ "$(PROG)" = "install" ]; then \
|
||||
if [ -f $(TERMUX_BIN)/$(TARGET) ]; then \
|
||||
$(E_NS) " - $(TARGET) already $(PROG)ed"; \
|
||||
exit 1; \
|
||||
fi; \
|
||||
fi
|
||||
|
||||
really_termux:
|
||||
@ if [ ! -f $(TERMUX_BIN)/termux-open ]; then \
|
||||
$(P) "$(RED)$(BOLD)Error:$(BOLD_RESET)$(RESET) This function is only available on Termux.\n"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
# end
|
||||
really_builded:
|
||||
if [ ! -f $(BINARY_DIR)/$(TARGET) ]; then \
|
||||
$(P) " - $(RED)$(BOLD)Error:$(BOLD_RESET)$(RESET) Package not builded! Please build package and try again \n"; \
|
||||
$(E_NS) "INSTALL_SUCCESS := false" > $(BUILD)/config/INS_STAT.mk; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
# end
|
||||
|
||||
Reference in New Issue
Block a user