summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts')
-rwxr-xr-xmeta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts33
1 files changed, 17 insertions, 16 deletions
diff --git a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
index 50c0a1afea..95dccb9cae 100755
--- a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
+++ b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
@@ -6,7 +6,8 @@
#
# The following script will run all the scriptlets found in #SYSCONFDIR#/deb-postinsts,
-# #SYSCONFDIR#/ipk-postinsts or #SYSCONFDIR#/rpm-postinsts.
+# #SYSCONFDIR#/ipk-postinsts or #SYSCONFDIR#/rpm-postinsts or the package manager in
+# case available.
# the order of this list is important, do not change!
backend_list="rpm deb ipk"
@@ -14,27 +15,29 @@ backend_list="rpm deb ipk"
pm_installed=false
for pm in $backend_list; do
- pi_dir="#SYSCONFDIR#/$pm-postinsts"
-
- if [ ! -d $pi_dir ]; then
- continue
- fi
-
# found the package manager, it has postinsts
case $pm in
"deb")
if [ -s "#LOCALSTATEDIR#/lib/dpkg/status" ]; then
pm_installed=true
+ break
fi
;;
"ipk")
if [ -s "#LOCALSTATEDIR#/lib/opkg/status" ]; then
pm_installed=true
+ break
fi
;;
esac
- break
+
+ pi_dir="#SYSCONFDIR#/$pm-postinsts"
+
+ # found postinsts directory
+ if [ -d $pi_dir ]; then
+ break
+ fi
done
remove_rcsd_link () {
@@ -43,7 +46,7 @@ remove_rcsd_link () {
fi
}
-if [ -z "$pi_dir" ]; then
+if ! [ -d $pi_dir ] && ! $pm_installed; then
remove_rcsd_link
exit 0
fi
@@ -64,17 +67,17 @@ exec_postinst_scriptlets() {
echo "Running postinst $i..."
[ "$POSTINST_LOGGING" = "1" ] && eval echo "Running postinst $i..." $append_log
if [ -x $i ]; then
- eval sh -c $i $append_log
+ (sh -c $i $append_log)
rm $i
else
echo "ERROR: postinst $i failed."
[ "$POSTINST_LOGGING" = "1" ] && eval echo "ERROR: postinst $i failed." $append_log
- remove_pi_dir=0
+ remove_rcsd_link=0
fi
done
}
-remove_pi_dir=1
+remove_rcsd_link=1
if $pm_installed; then
case $pm in
"ipk")
@@ -89,9 +92,7 @@ else
exec_postinst_scriptlets
fi
-# since all postinstalls executed successfully, remove the postinstalls directory
-# and the rcS.d link
-if [ $remove_pi_dir = 1 ]; then
- rm -rf $pi_dir
+# since all postinstalls executed successfully, remove the rcS.d link
+if [ $remove_rcsd_link = 1 ]; then
remove_rcsd_link
fi