summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/run-postinsts
diff options
context:
space:
mode:
authorLaurentiu Palcu <laurentiu.palcu@intel.com>2014-03-06 14:15:41 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-07 15:05:08 +0000
commit5159ddcb62682e1b7e63a20a9218ea96e3fe10a2 (patch)
tree0c51d7a4a862c6a81fb07e2c758ee8295c370384 /meta/recipes-devtools/run-postinsts
parent635c08c8c21e4faf4041fc5a3eaec87848b08d93 (diff)
downloadast2050-yocto-poky-5159ddcb62682e1b7e63a20a9218ea96e3fe10a2.zip
ast2050-yocto-poky-5159ddcb62682e1b7e63a20a9218ea96e3fe10a2.tar.gz
run-postinsts: use it for opkg/dpkg too
Currently, opkg/dpkg have their own postinstalls that create a run-postinsts script which is run at first boot. This commit prepares the run-postinsts recipe/script to be used by opkg/dpkg when DISTRO_FEATURES includes package-management. [YOCTO #5666] (From OE-Core rev: f33555f52a4ee83f0bd205cdf483045fcd0578b2) Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/run-postinsts')
-rwxr-xr-xmeta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts63
-rw-r--r--meta/recipes-devtools/run-postinsts/run-postinsts_1.0.bb2
2 files changed, 42 insertions, 23 deletions
diff --git a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
index 11141ec..08cfa9e 100755
--- a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
+++ b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts
@@ -8,13 +8,9 @@
# The following script will run all the scriptlets found in #SYSCONFDIR#/deb-postinsts,
# #SYSCONFDIR#/ipk-postinsts or #SYSCONFDIR#/rpm-posinsts.
-pi_dir=""
-for pm in rpm deb ipk; do
- if [ -d "#SYSCONFDIR#/${pm}-postinsts" ]; then
- pi_dir=#SYSCONFDIR#/${pm}-postinsts
- break
- fi
-done
+pm=#IMAGE_PKGTYPE#
+pm_installed=#PM_INSTALLED#
+pi_dir=#SYSCONFDIR#/${pm}-postinsts
remove_rcsd_link () {
if [ -n "`which update-rc.d`" ]; then
@@ -29,24 +25,45 @@ fi
[ -e #SYSCONFDIR#/default/postinst ] && . #SYSCONFDIR#/default/postinst
-remove_pi_dir=1
-for i in `ls $pi_dir`; do
- i=$pi_dir/$i
- echo "Running postinst $i..."
- [ "$POSTINST_LOGGING" = "1" ] && echo "Running postinst $i..." >> $LOGFILE
- if [ -x $i ]; then
- if [ "$POSTINST_LOGGING" = "1" ]; then
- sh -c $i >>$LOGFILE 2>&1
+if [ "$POSTINST_LOGGING" = "1" ]; then
+ rm -f $LOGFILE
+ append_log=">>$LOGFILE 2>&1"
+fi
+
+exec_postinst_scriptlets() {
+ for i in `ls $pi_dir`; do
+ i=$pi_dir/$i
+ echo "Running postinst $i..."
+ [ "$POSTINST_LOGGING" = "1" ] && eval echo "Running postinst $i..." $append_log
+ if [ -x $i ]; then
+ eval sh -c $i $append_log
+ rm $i
else
- sh -c $i
+ echo "ERROR: postinst $i failed."
+ [ "$POSTINST_LOGGING" = "1" ] && eval echo "ERROR: postinst $i failed." $append_log
+ remove_pi_dir=0
fi
- rm $i
- else
- echo "ERROR: postinst $i failed."
- [ "$POSTINST_LOGGING" = "1" ] && echo "ERROR: postinst $i failed." >> $LOGFILE
- remove_pi_dir=0
- fi
-done
+ done
+}
+
+remove_pi_dir=1
+if $pm_installed; then
+ case $pm in
+ "ipk")
+ eval opkg-cl configure $append_log
+ ;;
+
+ "deb")
+ eval dpkg --configure -a $append_log
+ ;;
+
+ "rpm")
+ exec_postinst_scriptlets
+ ;;
+ esac
+else
+ exec_postinst_scriptlets
+fi
# since all postinstalls executed successfully, remove the postinstalls directory
# and the rcS.d link
diff --git a/meta/recipes-devtools/run-postinsts/run-postinsts_1.0.bb b/meta/recipes-devtools/run-postinsts/run-postinsts_1.0.bb
index 64f85c2..e990c67 100644
--- a/meta/recipes-devtools/run-postinsts/run-postinsts_1.0.bb
+++ b/meta/recipes-devtools/run-postinsts/run-postinsts_1.0.bb
@@ -37,6 +37,8 @@ do_install() {
sed -i -e 's:#SYSCONFDIR#:${sysconfdir}:g' \
-e 's:#SBINDIR#:${sbindir}:g' \
-e 's:#BASE_BINDIR#:${base_bindir}:g' \
+ -e 's:#IMAGE_PKGTYPE#:${IMAGE_PKGTYPE}:g' \
+ -e 's:#PM_INSTALLED#:${@base_contains("IMAGE_FEATURES", "package-management", "true", "false", d)}:g' \
${D}${sbindir}/run-postinsts \
${D}${systemd_unitdir}/system/run-postinsts.service
}
OpenPOWER on IntegriCloud