Skip to content

Commit

Permalink
include/package-pack: remove leading whitespace from install scripts
Browse files Browse the repository at this point in the history
Strip off initial leading blanks and tabs from scripts and script
fragments that are supplied by the package's Makefile.  Specifically,
the script included in the postrm must be left justified so that
the shebang is in the first column.

Fixes: openwrt/openwrt#17439
Signed-off-by: Eric Fahlgren <[email protected]>
Link: openwrt/openwrt#17440
Signed-off-by: Robert Marko <[email protected]>
  • Loading branch information
efahl authored and robimarko committed Jan 10, 2025
1 parent c113982 commit b52e897
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions include/package-pack.mk
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ else
echo 'export pkgname="$(1)"'; \
echo "add_group_and_user"; \
echo "default_postinst"; \
[ ! -f $$(ADIR_$(1))/postinst-pkg ] || cat "$$(ADIR_$(1))/postinst-pkg"; \
[ ! -f $$(ADIR_$(1))/postinst-pkg ] || sed -z 's/^\s*#!/#!/' "$$(ADIR_$(1))/postinst-pkg"; \
) > $$(ADIR_$(1))/post-install;

( \
Expand All @@ -312,9 +312,11 @@ else
echo 'export root="$$$${IPKG_INSTROOT}"'; \
echo 'export pkgname="$(1)"'; \
echo "default_prerm"; \
[ ! -f $$(ADIR_$(1))/prerm-pkg ] || cat "$$(ADIR_$(1))/prerm-pkg"; \
[ ! -f $$(ADIR_$(1))/prerm-pkg ] || sed -z 's/^\s*#!/#!/' "$$(ADIR_$(1))/prerm-pkg"; \
) > $$(ADIR_$(1))/pre-deinstall;

[ ! -f $$(ADIR_$(1))/postrm ] || sed -zi 's/^\s*#!/#!/' "$$(ADIR_$(1))/postrm";

if [ -n "$(USERID)" ]; then echo $(USERID) > $$(IDIR_$(1))/lib/apk/packages/$(1).rusers; fi;
if [ -n "$(ALTERNATIVES)" ]; then echo $(ALTERNATIVES) > $$(IDIR_$(1))/lib/apk/packages/$(1).alternatives; fi;
(cd $$(IDIR_$(1)) && find . -type f,l -printf "/%P\n" > $$(IDIR_$(1))/lib/apk/packages/$(1).list)
Expand Down

0 comments on commit b52e897

Please sign in to comment.