diff options
author | Patrick Williams <patrick@stwcx.xyz> | 2016-08-17 14:31:25 -0500 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2016-08-22 16:43:26 +0000 |
commit | 60f9d69e016b11c468c98ea75ba0a60c44afbbc4 (patch) | |
tree | ecb49581a9e41a37943c22cd9ef3f63451b20ee7 /import-layers/yocto-poky/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts | |
parent | e18c61205e0234b03697129c20cc69c9b3940efc (diff) | |
download | blackbird-openbmc-60f9d69e016b11c468c98ea75ba0a60c44afbbc4.tar.gz blackbird-openbmc-60f9d69e016b11c468c98ea75ba0a60c44afbbc4.zip |
yocto-poky: Move to import-layers subdir
We are going to import additional layers, so create a subdir to
hold all of the layers that we import with git-subtree.
Change-Id: I6f732153a22be8ca663035c518837e3cc5ec0799
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Diffstat (limited to 'import-layers/yocto-poky/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts')
-rwxr-xr-x | import-layers/yocto-poky/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts b/import-layers/yocto-poky/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts new file mode 100755 index 000000000..53a8e1db0 --- /dev/null +++ b/import-layers/yocto-poky/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts @@ -0,0 +1,92 @@ +#!/bin/sh +# +# Copyright 2007 Openedhand Ltd. +# +# Author: Richard Purdie <rpurdie@openedhand.com> +# + +# The following script will run all the scriptlets found in #SYSCONFDIR#/deb-postinsts, +# #SYSCONFDIR#/ipk-postinsts or #SYSCONFDIR#/rpm-posinsts. + +# the order of this list is important, do not change! +backend_list="rpm deb ipk" + +pm_installed=false + +for pm in $backend_list; do + pi_dir="#SYSCONFDIR#/$pm-postinsts" + + [ -d $pi_dir ] && break + + case $pm in + "deb") + if [ -s "#LOCALSTATEDIR#/lib/dpkg/status" ]; then + pm_installed=true + break + fi + ;; + + "ipk") + if [ -s "/var/lib/opkg/status" ]; then + pm_installed=true + break + fi + ;; + esac +done + +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 + +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 + echo "ERROR: postinst $i failed." + [ "$POSTINST_LOGGING" = "1" ] && eval echo "ERROR: postinst $i failed." $append_log + remove_pi_dir=0 + fi + done +} + +remove_pi_dir=1 +if $pm_installed; then + case $pm in + "ipk") + eval opkg configure $append_log + ;; + + "deb") + eval dpkg --configure -a $append_log + ;; + esac +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 + remove_rcsd_link +fi |