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>
This commit is contained in:
Matthias Schiffer 2016-09-26 15:25:37 +02:00
parent 43bf3e80b2
commit 26b4216f95
No known key found for this signature in database
GPG key ID: 16EF3F64CB201D9C

View file

@ -164,12 +164,20 @@ insert_modules() {
} }
default_prerm() { default_prerm() {
local root="${IPKG_INSTROOT}"
local name local name
name=$(basename ${1%.*}) name=$(basename ${1%.*})
[ -f /usr/lib/opkg/info/${name}.prerm-pkg ] && . /usr/lib/opkg/info/${name}.prerm-pkg [ -f "$root/usr/lib/opkg/info/${name}.prerm-pkg" ] && . "$root/usr/lib/opkg/info/${name}.prerm-pkg"
for i in `cat /usr/lib/opkg/info/${name}.list | grep "^/etc/init.d/"`; do
$i disable local shell="$(which bash)"
$i stop 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 done
} }