[source] base-files: don't modify enabled state of service on upgrade

LEDE Commits lede-commits at lists.infradead.org
Mon Nov 21 09:41:55 PST 2016


jogo pushed a commit to source.git, branch master:
https://git.lede-project.org/afaa34ccd7343e478df8c0cd49019363692bcd16

commit afaa34ccd7343e478df8c0cd49019363692bcd16
Author: Jonas Gorski <jonas.gorski at gmail.com>
AuthorDate: Mon Nov 21 15:16:07 2016 +0100

    base-files: don't modify enabled state of service on upgrade
    
    Properly stop/start services on upgrade, but don't change the enabled
    state.
    
    Signed-off-by: Jonas Gorski <jonas.gorski at gmail.com>
    Acked-by: Jo-Philipp Wich <jo at mein.io>
---
 package/base-files/Makefile               |  2 +-
 package/base-files/files/lib/functions.sh | 22 ++++++++++++----------
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/package/base-files/Makefile b/package/base-files/Makefile
index 637d88b..85406a0 100644
--- a/package/base-files/Makefile
+++ b/package/base-files/Makefile
@@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk
 include $(INCLUDE_DIR)/version.mk
 
 PKG_NAME:=base-files
-PKG_RELEASE:=170
+PKG_RELEASE:=171
 PKG_FLAGS:=nonshared
 
 PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh
index 232a1c4..a5838f6 100755
--- a/package/base-files/files/lib/functions.sh
+++ b/package/base-files/files/lib/functions.sh
@@ -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
 }



More information about the lede-commits mailing list