diff options
-rwxr-xr-x | meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts | 63 | ||||
-rw-r--r-- | meta/recipes-devtools/run-postinsts/run-postinsts_1.0.bb | 2 |
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 | ||
11 | pi_dir="" | 11 | pm=#IMAGE_PKGTYPE# |
12 | for pm in rpm deb ipk; do | 12 | pm_installed=#PM_INSTALLED# |
13 | if [ -d "#SYSCONFDIR#/${pm}-postinsts" ]; then | 13 | pi_dir=#SYSCONFDIR#/${pm}-postinsts |
14 | pi_dir=#SYSCONFDIR#/${pm}-postinsts | ||
15 | break | ||
16 | fi | ||
17 | done | ||
18 | 14 | ||
19 | remove_rcsd_link () { | 15 | remove_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 | ||
32 | remove_pi_dir=1 | 28 | if [ "$POSTINST_LOGGING" = "1" ]; then |
33 | for 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..." | 31 | fi |
36 | [ "$POSTINST_LOGGING" = "1" ] && echo "Running postinst $i..." >> $LOGFILE | 32 | |
37 | if [ -x $i ]; then | 33 | exec_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 | 49 | remove_pi_dir=1 |
47 | remove_pi_dir=0 | 50 | if $pm_installed; then |
48 | fi | 51 | case $pm in |
49 | done | 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 | ||
64 | else | ||
65 | exec_postinst_scriptlets | ||
66 | fi | ||
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 | } |