summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Sapkin2026-01-05 22:56:06 +0000
committerRobert Marko2026-01-16 16:13:00 +0000
commitf74790057f601e4d178bcc2f30065566f549e289 (patch)
tree3e032b8a093bd20d7d7378f71c54867ab2597140
parent46244b6b0becf2634c2bbef67ec6331c3ed274e4 (diff)
downloadopenwrt-f74790057f601e4d178bcc2f30065566f549e289.tar.gz
build: remove redundant shebang from apk lifecycle scripts
Due to the way apk lifecycle scripts are defined, they might end up with multiple shebangs. Remove them. Before: post-upgrade: | #!/bin/sh export PKG_UPGRADE=1 #!/bin/sh [ "${IPKG_NO_SCRIPT}" = "1" ] && exit 0 [ -s ${IPKG_INSTROOT}/lib/functions.sh ] || exit 0 . ${IPKG_INSTROOT}/lib/functions.sh export root="${IPKG_INSTROOT}" export pkgname="adblock-fast" add_group_and_user default_postinst #!/bin/sh # check if we are on real system if [ -z "${IPKG_INSTROOT}" ]; then /etc/init.d/adblock-fast enable fi exit 0 After: post-upgrade: | #!/bin/sh export PKG_UPGRADE=1 [ "${IPKG_NO_SCRIPT}" = "1" ] && exit 0 [ -s ${IPKG_INSTROOT}/lib/functions.sh ] || exit 0 . ${IPKG_INSTROOT}/lib/functions.sh export root="${IPKG_INSTROOT}" export pkgname="adblock-fast" add_group_and_user default_postinst # check if we are on real system if [ -z "${IPKG_INSTROOT}" ]; then /etc/init.d/adblock-fast enable fi exit 0 Fixes: b52e897 ("include/package-pack: remove leading whitespace from install scripts") Fixes: 03880e2 ("include/package-pack: add missing apk package lifecycle events") Signed-off-by: George Sapkin <george@sapk.in> Link: https://github.com/openwrt/openwrt/pull/21369 (cherry picked from commit 1dec4683f6a91cb0734e97186738b0ea413bb356) Link: https://github.com/openwrt/openwrt/pull/21547 Signed-off-by: Robert Marko <robimarko@gmail.com>
-rw-r--r--include/package-pack.mk8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/package-pack.mk b/include/package-pack.mk
index 6a80d3d970..3fcab2da02 100644
--- a/include/package-pack.mk
+++ b/include/package-pack.mk
@@ -505,21 +505,21 @@ else
echo 'export pkgname="$(1)$$(ABIV_$(1))"'; \
echo "add_group_and_user"; \
echo "default_postinst"; \
- [ ! -f $$(ADIR_$(1))/postinst-pkg ] || sed -z 's/^\s*#!/#!/' "$$(ADIR_$(1))/postinst-pkg"; \
+ [ ! -f $$(ADIR_$(1))/postinst-pkg ] || sed '/^\s*#!/d' "$$(ADIR_$(1))/postinst-pkg"; \
) > $$(ADIR_$(1))/post-install;
ifdef Package/$(1)/preinst
( \
echo "#!/bin/sh"; \
echo 'export PKG_UPGRADE=1'; \
- [ ! -f $$(ADIR_$(1))/preinst ] || sed -z 's/^\s*#!/#!/' "$$(ADIR_$(1))/preinst"; \
+ [ ! -f $$(ADIR_$(1))/preinst ] || sed '/^\s*#!/d' "$$(ADIR_$(1))/preinst"; \
) > $$(ADIR_$(1))/pre-upgrade;
endif
( \
echo "#!/bin/sh"; \
echo 'export PKG_UPGRADE=1'; \
- [ ! -f $$(ADIR_$(1))/post-install ] || sed -z 's/^\s*#!/#!/' "$$(ADIR_$(1))/post-install"; \
+ [ ! -f $$(ADIR_$(1))/post-install ] || sed '/^\s*#!/d' "$$(ADIR_$(1))/post-install"; \
) > $$(ADIR_$(1))/post-upgrade;
( \
@@ -529,7 +529,7 @@ else
echo 'export root="$$$${IPKG_INSTROOT}"'; \
echo 'export pkgname="$(1)$$(ABIV_$(1))"'; \
echo "default_prerm"; \
- [ ! -f $$(ADIR_$(1))/prerm-pkg ] || sed -z 's/^\s*#!/#!/' "$$(ADIR_$(1))/prerm-pkg"; \
+ [ ! -f $$(ADIR_$(1))/prerm-pkg ] || sed '/^\s*#!/d' "$$(ADIR_$(1))/prerm-pkg"; \
) > $$(ADIR_$(1))/pre-deinstall;
[ ! -f $$(ADIR_$(1))/postrm ] || sed -zi 's/^\s*#!/#!/' "$$(ADIR_$(1))/postrm";