Patchwork [1/2] run-postinsts: remove the init script after a clean start-up

login
register
mail settings
Submitter Qi.Chen@windriver.com
Date Jan. 13, 2014, 7:38 a.m.
Message ID <c987728f966e5b0d04bf347135b39bfffc71de3d.1389598673.git.Qi.Chen@windriver.com>
Download mbox | patch
Permalink /patch/64591/
State Accepted
Commit 78484bf45e8052373cbf25f10c380b6e674ef5db
Headers show

Comments

Qi.Chen@windriver.com - Jan. 13, 2014, 7:38 a.m.
If we enable ipk/deb package back-end, and we have 'package-management'
in our IMAGE_FEATURES, then the /etc/rcS.d/S99run-postinsts would
still exist in our system after a clean start-up.

The initial design for run-postinsts requires the related init script
to be removed if there's no more post-install script left in the system.

This patch fixes this problem.

[YOCTO #5718]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 .../run-postinsts/run-postinsts/run-postinsts      |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

Patch

diff --git a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
index c94c3e9..11141ec 100755
--- a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
+++ b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
@@ -16,7 +16,16 @@  for pm in rpm deb ipk; do
 	fi
 done
 
-[ -z "$pi_dir" ] && exit 0
+remove_rcsd_link () {
+	if [ -n "`which update-rc.d`" ]; then
+		update-rc.d -f run-postinsts remove
+	fi
+}
+
+if [ -z "$pi_dir" ]; then
+	remove_rcsd_link
+	exit 0
+fi
 
 [ -e #SYSCONFDIR#/default/postinst ] && . #SYSCONFDIR#/default/postinst
 
@@ -43,7 +52,5 @@  done
 # and the rcS.d link
 if [ $remove_pi_dir = 1 ]; then
 	rm -rf $pi_dir
-	if [ -n "`which update-rc.d`" ]; then
-		update-rc.d -f run-postinsts remove
-	fi
+	remove_rcsd_link
 fi