diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2016-09-26 15:25:37 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2016-09-26 17:57:57 +0200 |
commit | 26b4216f95d2c262144d7e3744b0a541cf210506 (patch) | |
tree | 717392dede47d57a4b9c6402b989f97048dd785a /package/base-files/files | |
parent | 43bf3e80b2bcde1930d8d794d8719bf3137ba031 (diff) | |
download | mtk-20170518-26b4216f95d2c262144d7e3744b0a541cf210506.zip mtk-20170518-26b4216f95d2c262144d7e3744b0a541cf210506.tar.gz mtk-20170518-26b4216f95d2c262144d7e3744b0a541cf210506.tar.bz2 |
base-files: make default_prerm work offline
IPKG_INSTROOT must be respected for offline removal (used for per-device
rootfs).
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Diffstat (limited to 'package/base-files/files')
-rwxr-xr-x | package/base-files/files/lib/functions.sh | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh index e6c6822..232a1c4 100755 --- a/package/base-files/files/lib/functions.sh +++ b/package/base-files/files/lib/functions.sh @@ -164,12 +164,20 @@ insert_modules() { } default_prerm() { + local root="${IPKG_INSTROOT}" local name + name=$(basename ${1%.*}) - [ -f /usr/lib/opkg/info/${name}.prerm-pkg ] && . /usr/lib/opkg/info/${name}.prerm-pkg - for i in `cat /usr/lib/opkg/info/${name}.list | grep "^/etc/init.d/"`; do - $i disable - $i stop + [ -f "$root/usr/lib/opkg/info/${name}.prerm-pkg" ] && . "$root/usr/lib/opkg/info/${name}.prerm-pkg" + + local shell="$(which bash)" + for i in `cat "$root/usr/lib/opkg/info/${name}.list" | grep "^/etc/init.d/"`; do + if [ -n "$root" ]; then + ${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" disable + else + "$i" disable + "$i" stop + fi done } |