3 # Copyright 2007 Openedhand Ltd.
5 # Author: Richard Purdie <rpurdie@openedhand.com>
8 # The following script will run all the scriptlets found in #SYSCONFDIR#/deb-postinsts,
9 # #SYSCONFDIR#/ipk-postinsts or #SYSCONFDIR#/rpm-posinsts.
11 # the order of this list is important, do not change!
12 backend_list="rpm deb ipk"
16 for pm in $backend_list; do
17 pi_dir="#SYSCONFDIR#/$pm-postinsts"
19 [ -d $pi_dir ] && break
23 if [ -s "/var/lib/dpkg/status" ]; then
36 if [ -n "`which update-rc.d`" ]; then
37 update-rc.d -f run-postinsts remove
41 if [ -z "$pi_dir" ]; then
46 [ -e #SYSCONFDIR#/default/postinst ] && . #SYSCONFDIR#/default/postinst
48 if [ "$POSTINST_LOGGING" = "1" ]; then
50 append_log=">>$LOGFILE 2>&1"
53 exec_postinst_scriptlets() {
54 for i in `ls $pi_dir`; do
56 echo "Running postinst $i..."
57 [ "$POSTINST_LOGGING" = "1" ] && eval echo "Running postinst $i..." \$append_log
59 eval sh -c $i \$append_log
62 echo "ERROR: postinst $i failed."
63 [ "$POSTINST_LOGGING" = "1" ] && eval echo "ERROR: postinst $i failed." \$append_log
70 if $pm_installed; then
73 eval opkg-cl configure \$append_log
77 eval dpkg --configure -a \$append_log
81 exec_postinst_scriptlets
84 # since all postinstalls executed successfully, remove the postinstalls directory
86 if [ $remove_pi_dir = 1 ]; then