summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools
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
parent635c08c8c21e4faf4041fc5a3eaec87848b08d93 (diff)
downloadpoky-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')
-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 11141ec71f..08cfa9e59f 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 @@
8# The following script will run all the scriptlets found in #SYSCONFDIR#/deb-postinsts, 8# The following script will run all the scriptlets found in #SYSCONFDIR#/deb-postinsts,
9# #SYSCONFDIR#/ipk-postinsts or #SYSCONFDIR#/rpm-posinsts. 9# #SYSCONFDIR#/ipk-postinsts or #SYSCONFDIR#/rpm-posinsts.
10 10
11pi_dir="" 11pm=#IMAGE_PKGTYPE#
12for pm in rpm deb ipk; do 12pm_installed=#PM_INSTALLED#
13 if [ -d "#SYSCONFDIR#/${pm}-postinsts" ]; then 13pi_dir=#SYSCONFDIR#/${pm}-postinsts
14 pi_dir=#SYSCONFDIR#/${pm}-postinsts
15 break
16 fi
17done
18 14
19remove_rcsd_link () { 15remove_rcsd_link () {
20 if [ -n "`which update-rc.d`" ]; then 16 if [ -n "`which update-rc.d`" ]; then
@@ -29,24 +25,45 @@ fi
29 25
30[ -e #SYSCONFDIR#/default/postinst ] && . #SYSCONFDIR#/default/postinst 26[ -e #SYSCONFDIR#/default/postinst ] && . #SYSCONFDIR#/default/postinst
31 27
32remove_pi_dir=1 28if [ "$POSTINST_LOGGING" = "1" ]; then
33for i in `ls $pi_dir`; do 29 rm -f $LOGFILE
34 i=$pi_dir/$i 30 append_log=">>$LOGFILE 2>&1"
35 echo "Running postinst $i..." 31fi
36 [ "$POSTINST_LOGGING" = "1" ] && echo "Running postinst $i..." >> $LOGFILE 32
37 if [ -x $i ]; then 33exec_postinst_scriptlets() {
38 if [ "$POSTINST_LOGGING" = "1" ]; then 34 for i in `ls $pi_dir`; do
39 sh -c $i >>$LOGFILE 2>&1 35 i=$pi_dir/$i
36 echo "Running postinst $i..."
37 [ "$POSTINST_LOGGING" = "1" ] && eval echo "Running postinst $i..." $append_log
38 if [ -x $i ]; then
39 eval sh -c $i $append_log
40 rm $i
40 else 41 else
41 sh -c $i 42 echo "ERROR: postinst $i failed."
43 [ "$POSTINST_LOGGING" = "1" ] && eval echo "ERROR: postinst $i failed." $append_log
44 remove_pi_dir=0
42 fi 45 fi
43 rm $i 46 done
44 else 47}
45 echo "ERROR: postinst $i failed." 48
46 [ "$POSTINST_LOGGING" = "1" ] && echo "ERROR: postinst $i failed." >> $LOGFILE 49remove_pi_dir=1
47 remove_pi_dir=0 50if $pm_installed; then
48 fi 51 case $pm in
49done 52 "ipk")
53 eval opkg-cl configure $append_log
54 ;;
55
56 "deb")
57 eval dpkg --configure -a $append_log
58 ;;
59
60 "rpm")
61 exec_postinst_scriptlets
62 ;;
63 esac
64else
65 exec_postinst_scriptlets
66fi
50 67
51# since all postinstalls executed successfully, remove the postinstalls directory 68# since all postinstalls executed successfully, remove the postinstalls directory
52# and the rcS.d link 69# 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 64f85c262d..e990c670c0 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() {
37 sed -i -e 's:#SYSCONFDIR#:${sysconfdir}:g' \ 37 sed -i -e 's:#SYSCONFDIR#:${sysconfdir}:g' \
38 -e 's:#SBINDIR#:${sbindir}:g' \ 38 -e 's:#SBINDIR#:${sbindir}:g' \
39 -e 's:#BASE_BINDIR#:${base_bindir}:g' \ 39 -e 's:#BASE_BINDIR#:${base_bindir}:g' \
40 -e 's:#IMAGE_PKGTYPE#:${IMAGE_PKGTYPE}:g' \
41 -e 's:#PM_INSTALLED#:${@base_contains("IMAGE_FEATURES", "package-management", "true", "false", d)}:g' \
40 ${D}${sbindir}/run-postinsts \ 42 ${D}${sbindir}/run-postinsts \
41 ${D}${systemd_unitdir}/system/run-postinsts.service 43 ${D}${systemd_unitdir}/system/run-postinsts.service
42} 44}