diff options
Diffstat (limited to 'meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts')
-rwxr-xr-x | meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts b/meta/recipes-devtools/run-postinsts/run-postinsts/run-postinsts index 04ba3941bc..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,10 +15,7 @@ backend_list="rpm deb ipk" pm_installed=false for pm in $backend_list; do - pi_dir="#SYSCONFDIR#/$pm-postinsts" - - [ -d $pi_dir ] && break - + # found the package manager, it has postinsts case $pm in "deb") if [ -s "#LOCALSTATEDIR#/lib/dpkg/status" ]; then @@ -27,12 +25,19 @@ for pm in $backend_list; do ;; "ipk") - if [ -s "/var/lib/opkg/status" ]; then + if [ -s "#LOCALSTATEDIR#/lib/opkg/status" ]; then pm_installed=true break fi ;; esac + + pi_dir="#SYSCONFDIR#/$pm-postinsts" + + # found postinsts directory + if [ -d $pi_dir ]; then + break + fi done remove_rcsd_link () { @@ -41,11 +46,14 @@ remove_rcsd_link () { fi } -if [ -z "$pi_dir" ]; then +if ! [ -d $pi_dir ] && ! $pm_installed; then remove_rcsd_link exit 0 fi +echo "Configuring packages on first boot...." +echo " (This may take several minutes. Please do not power off the machine.)" + [ -e #SYSCONFDIR#/default/postinst ] && . #SYSCONFDIR#/default/postinst if [ "$POSTINST_LOGGING" = "1" ]; then @@ -59,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") @@ -84,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 |