aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/lib
diff options
context:
space:
mode:
Diffstat (limited to 'package/base-files/files/lib')
-rwxr-xr-xpackage/base-files/files/lib/functions.sh16
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 e6c6822cec..232a1c4ed2 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
}