base-files: enable presence of uci when IPKG_INSTROOT is set
[openwrt/staging/yousong.git] / package / base-files / files / lib / functions.sh
index a5838f6035cd5462a2fb51043885923ad261a2b3..de3fa96730393b76e39bd4d3ea5f41a104c16b69 100755 (executable)
@@ -35,7 +35,6 @@ list_contains() {
 }
 
 config_load() {
-       [ -n "$IPKG_INSTROOT" ] && return 0
        uci_load "$@"
 }
 
@@ -178,7 +177,7 @@ default_prerm() {
                        if [ "$PKG_UPGRADE" != "1" ]; then
                                "$i" disable
                        fi
-                       "$i" stop
+                       "$i" stop || /bin/true
                fi
        done
 }
@@ -230,6 +229,11 @@ default_postinst() {
                ret=$?
        fi
 
+       if [ -d "$root/rootfs-overlay" ]; then
+               cp -R $root/rootfs-overlay/. $root/
+               rm -fR $root/rootfs-overlay/
+       fi
+
        if [ -z "$root" ] && grep -q -s "^/etc/uci-defaults/" "/usr/lib/opkg/info/${pkgname}.list"; then
                . /lib/functions/system.sh
                [ -d /tmp/.uci ] || mkdir -p /tmp/.uci
@@ -348,4 +352,4 @@ user_exists() {
        grep -qs "^${1}:" ${IPKG_INSTROOT}/etc/passwd
 }
 
-[ -z "$IPKG_INSTROOT" -a -f /lib/config/uci.sh ] && . /lib/config/uci.sh
+. $IPKG_INSTROOT/lib/config/uci.sh