zsh: fix invalid postrm script and little refactor of scripts
authorKarel Kočí <karel.koci@nic.cz>
Wed, 18 Dec 2019 08:57:23 +0000 (09:57 +0100)
committerJosef Schlehofer <pepe.schlehofer@gmail.com>
Fri, 17 Dec 2021 22:48:16 +0000 (23:48 +0100)
The postrm script was missing shebang. Postrm scripts are packaged and
executed directly and not sourced by default script (as in case of prerm
and postinst).

Also move some indents around to not confuse reader. The section in
postinst was indented to same level as grep "condition" but is on same
level as initial grep (not part of that "condition").

Signed-off-by: Karel Kočí <karel.koci@nic.cz>
(cherry picked from commit d2d193d81885cd2351e3bd53f6f4cc8ec092e26d)

utils/zsh/Makefile

index b3f96d2ac32d2aba207e13af5c35fc0f487d61a3..85b441f9f94ac04522bf1baab2e32d3b7f63800c 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=zsh
 PKG_VERSION:=5.6.2
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@SF/zsh
@@ -91,10 +91,10 @@ define Package/zsh/postinst
 grep zsh $${IPKG_INSTROOT}/etc/shells || \
        echo "/usr/bin/zsh" >> $${IPKG_INSTROOT}/etc/shells
 
-       # Backwards compatibility
-       if [[ -e /bin/zsh ]] && ([[ ! -L /bin/zsh ]] || [[ "$(readlink -fn $${IPKG_INSTROOT}/bin/zsh)" != "../$(CONFIGURE_PREFIX)/bin/zsh" ]]); then
-               ln -fs "../$(CONFIGURE_PREFIX)/bin/zsh" "$${IPKG_INSTROOT}/bin/zsh"
-       fi
+# Backwards compatibility
+if [[ -e /bin/zsh ]] && ([[ ! -L /bin/zsh ]] || [[ "$(readlink -fn $${IPKG_INSTROOT}/bin/zsh)" != "../$(CONFIGURE_PREFIX)/bin/zsh" ]]); then
+       ln -fs "../$(CONFIGURE_PREFIX)/bin/zsh" "$${IPKG_INSTROOT}/bin/zsh"
+fi
 endef
 
 define Package/zsh/install
@@ -107,7 +107,8 @@ define Package/zsh/install
 endef
 
 define Package/zsh/postrm
-       rm -rf "$${IPKG_INSTROOT}/$(CONFIGURE_PREFIX)/share/zsh/$(PKG_VERSION)"
+#!/bin/sh
+rm -rf "$${IPKG_INSTROOT}/$(CONFIGURE_PREFIX)/share/zsh/$(PKG_VERSION)"
 endef
 
 $(eval $(call BuildPackage,zsh))