pmt: initial 2.6.0 update

This commit is contained in:
2024-07-28 23:01:21 +03:00
parent 36efab6eb3
commit 5b00b0bfe3
27 changed files with 706 additions and 677 deletions

View File

@@ -1,6 +1,6 @@
Source: pmt
Package: pmt
Version: 2.5.0
Version: 2.6.0
Architecture: arm
Description: pmt is for reading, writing and formatting partitions of android devices
Section: misc

View File

@@ -1,6 +1,6 @@
Source: pmt
Package: pmt
Version: 2.5.0
Version: 2.6.0
Architecture: aarch64
Description: pmt is for reading, writing and formatting partitions of android devices
Section: misc

View File

@@ -32,76 +32,68 @@ else ifeq ($(FOR_THIS),32)
endif
ifneq ($(wildcard /dev/block/by-name),)
SUDO := su
SUDO := su -c
else ifeq ($(wildcard /system/build.prop),)
SUDO := sudo
else
SUDO :=
endif
# controls the presence of file/directory. usage: $(call check_local,<FILE_OR_DIRECTORY_PATH>,<PACKAGE_STAT: 1, NULL>)
define check_local
# the first argument is taken and controlled by the file/directory with -e option
if [ ! -e $1 ]; then \
if [ $2 = 1 ]; then \
printf " - Package not builded! Please build package and try again.\n"; \
else \
printf " ==> Not found: $1\n"; \
fi; \
if [ -d "$(TEMP_DIR)" ]; then \
rm -rf $(TEMP_DIR); \
fi; \
exit 1; \
fi;
endef
PROGRESS_LIST := \
startup \
$(DEB_CHECKS) \
check_binary \
prepare \
make_debian_pack
# make deb package
all:
$(hide)printf " --------- Making deb package ---------\n"
# remove template directory
$(call erase,$(TEMP_DIR))
$(hide)printf " - Checking files and directories (only neededs)...\n"
# check some files and directories with parsing DEB_CHECKS variable
$(foreach deb_chfile, \
$(DEB_CHECKS), \
$(call check_local,$(deb_chfile)) \
)
# check build status
$(call check_local, \
$(BINARY_DIR)/pmt, \
1 \
)
# make template and output directories
$(call mdir,$(TEMP_DIR),"y")
$(call mdir,$(DEB_DIR),"y")
$(hide)printf " - Copying files...\n"
# prepare
$(hide)cp -r $(DEBUTILS_DIR)/data $(TEMP_DIR) || exit 1
$(hide)rm -f $(DEBTERMUX_USR)/share/man/man8/dummy
$(hide)rm -f $(DEBTERMUX_USR)/bin/dummy
$(call mdir,$(TEMP_DIR)/DEBIAN)
$(hide)abort() { \
if [ -d $(TEMP_DIR) ]; then \
rm -rf $(TEMP_DIR); \
fi; \
if [ -d $(DEB_DIR) ]; then \
rm -rf $(DEB_DIR); \
fi; \
all: $(PROGRESS_LIST)
startup:
$(E) " --------- Making deb package --------- "
@ rm -rf $(TEMP_DIR)
$(E) " - Checking files and directories (only neededs)..."
prepare:
$(E) " - Copying files..."
@ cp -r $(DEBUTILS_DIR)/data $(TEMP_DIR) || exit 1
@ rm -f $(DEBTERMUX_USR)/share/man/man8/dummy
@ rm -f $(DEBTERMUX_USR)/bin/dummy
@ mkdir $(TEMP_DIR)/DEBIAN
check_binary:
@ if [ ! -f "$(BINARY_DIR)/pmt" ]; then \
$(E_NS) " - pmt not builded! Please build and retry."; \
exit 1; \
fi
$(E) " - Generating template directory..."
@ mkdir $(TEMP_DIR)
$(E) " - Generating debian package directory..."
@ mkdir $(DEB_DIR)
make_debian_pack:
@ abort() { \
[ -d $(TEMP_DIR) ] \
&& rm -rf $(TEMP_DIR); \
[ -d $(DEB_DIR) ] \
&& rm -rf $(DEB_DIR); \
exit 1; \
}; \
if [ ! "$(FOR_THIS)" = "64" ] && [ ! "$(FOR_THIS)" = "32" ]; then \
printf " - İnvalid arch number: $(FOR_THIS)\n" && abort; \
$(E_NS) " - Invalid arch number: $(FOR_THIS) [maybe null]" && abort; \
fi; \
printf " - Selected arm-$(FOR_THIS) package control file.\n"; \
$(E_NS) " - Selected arm-$(FOR_THIS) package control file."; \
cp $(DEBUTILS_DIR)/DEBIAN/control_$(FOR_THIS) $(TEMP_DIR)/DEBIAN/control || abort; \
cp $(DEBUTILS_DIR)/mandoc/$(TARGET).8.gz $(DEBTERMUX_USR)/share/man/man8 || abort; \
cp $(BINARY_DIR)/$(TARGET) $(DEBTERMUX_USR)/bin || abort; \
printf " - Starting dpkg-deb...\n"; \
$(E_NS) " - Starting dpkg-deb..."; \
sleep 2; \
$(SUDO) chmod -R 755 *; \
dpkg-deb -b $(TEMP_DIR) $(DEB_DIR)/$(TARGET)-$(DEB_ARCH_NAME).deb || abort; \
# cleanup template directory
rm -rf $(TEMP_DIR); \
printf " - Done!\n"
$(E_NS) " - Done!"
$(DEBUTILS_DIR)/%:
@ [ ! -e "$@" ] && $(E_NS) " - Check failed! Not found: $@" && exit 1
# end