acme: fix incompatibilty with image builder
authorGlen Huang <i@glenhuang.com>
Fri, 3 Mar 2023 03:08:32 +0000 (11:08 +0800)
committerToke Høiland-Jørgensen <toke@toke.dk>
Fri, 3 Mar 2023 22:43:01 +0000 (23:43 +0100)
Signed-off-by: Glen Huang <i@glenhuang.com>
net/acme-common/Makefile
net/acme-common/files/acme.init

index 49e5f76f7ee2a5951431038120307e27f5601a01..841146826d781ba71dc7404eed943b17a98b0362 100644 (file)
@@ -50,13 +50,17 @@ endef
 
 define Package/acme-common/postinst
 #!/bin/sh
-grep -q '/etc/init.d/acme' /etc/crontabs/root 2>/dev/null && exit 0
-echo "0 0 * * * /etc/init.d/acme start" >> /etc/crontabs/root
+if [ -z "$$IPKG_INSTROOT" ]; then
+       grep -q '/etc/init.d/acme' /etc/crontabs/root 2>/dev/null && exit 0
+       echo "0 0 * * * /etc/init.d/acme start" >> /etc/crontabs/root
+fi
 endef
 
 define Package/acme-common/prerm
 #!/bin/sh
-sed -i '\|/etc/init.d/acme|d' /etc/crontabs/root
+if [ -z "$$IPKG_INSTROOT" ]; then
+       sed -i '\|/etc/init.d/acme|d' /etc/crontabs/root
+fi
 endef
 
 define Build/Configure
index 1bca639f492c87d56e438ca995d2e00eb734b452..a97856496ececfe2bcbacfc9507f4bde4961cbe9 100644 (file)
@@ -9,7 +9,7 @@ HOOK=/usr/lib/acme/hook
 LOG_TAG=acme
 
 # shellcheck source=net/acme/files/functions.sh
-. /usr/lib/acme/functions.sh
+. "$IPKG_INSTROOT/usr/lib/acme/functions.sh"
 
 cleanup() {
        log debug "cleaning up"