name=$(basename ${1%.*})
[ -f "$root/usr/lib/opkg/info/${name}.prerm-pkg" ] && . "$root/usr/lib/opkg/info/${name}.prerm-pkg"
+ check_update_alternatives remove "${name}"
local shell="$(which bash)"
for i in `cat "$root/usr/lib/opkg/info/${name}.list" | grep "^/etc/init.d/"`; do
fi
}
+check_update_alternatives() {
+ local cmd="$1"
+ local pkgname="$2"
+ local altspecs="$(sed -ne 's/^Alternatives: *//p' $root/usr/lib/opkg/info/${pkgname}.control 2>/dev/null)"
+ local spec
+ local oIFS
+ local shell="$(which bash)"
+
+ shell="${shell:-/bin/sh}"
+ oIFS="$IFS"; IFS=", "
+ for spec in $altspecs; do
+ $shell ${IPKG_INSTROOT}/usr/sbin/update-alternatives "$cmd" --spec "$spec"
+ done
+ IFS="$oIFS"
+}
+
default_postinst() {
local root="${IPKG_INSTROOT}"
local pkgname="$(basename ${1%.*})"
local ret=0
add_group_and_user "${pkgname}"
+ check_update_alternatives update "${pkgname}"
if [ -f "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" ]; then
( . "$root/usr/lib/opkg/info/${pkgname}.postinst-pkg" )