base-files: don't modify enabled state of service on upgrade
[openwrt/staging/stintel.git] / package / base-files / files / lib / functions.sh
index 232a1c4ed250a71ffe7a78f3864d415a49b94550..a5838f6035cd5462a2fb51043885923ad261a2b3 100755 (executable)
@@ -175,7 +175,9 @@ default_prerm() {
                if [ -n "$root" ]; then
                        ${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" disable
                else
-                       "$i" disable
+                       if [ "$PKG_UPGRADE" != "1" ]; then
+                               "$i" disable
+                       fi
                        "$i" stop
                fi
        done
@@ -240,17 +242,17 @@ default_postinst() {
 
        [ -n "$root" ] || rm -f /tmp/luci-indexcache 2>/dev/null
 
-       if [ "$PKG_UPGRADE" != "1" ]; then
-               local shell="$(which bash)"
-               for i in $(grep -s "^/etc/init.d/" "$root/usr/lib/opkg/info/${pkgname}.list"); do
-                       if [ -n "$root" ]; then
-                               ${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" enable
-                       else
+       local shell="$(which bash)"
+       for i in $(grep -s "^/etc/init.d/" "$root/usr/lib/opkg/info/${pkgname}.list"); do
+               if [ -n "$root" ]; then
+                       ${shell:-/bin/sh} "$root/etc/rc.common" "$root$i" enable
+               else
+                       if [ "$PKG_UPGRADE" != "1" ]; then
                                "$i" enable
-                               "$i" start
                        fi
-               done
-       fi
+                       "$i" start
+               fi
+       done
 
        return $ret
 }