3 # Copyright 2017 IoT.bzh.
5 # Author: Ronan Le Martret <ronan.lemartret@iot.bzh>
8 # The following script will run all the scriptlets found in #SYSCONFDIR#/agl-postinsts.
10 agl_pi_dir="#SYSCONFDIR#/agl-postinsts"
13 LOGFILE=/var/log/agl-postinstall.log
15 [ -e $LOGFILE ] && mv ${LOGFILE} ${LOGFILE}.old.$(date +%F--%H%M.%S)
17 append_log=">>$LOGFILE 2>&1"
19 exec_postinst_scriptlets() {
20 for i in `ls $agl_pi_dir`; do
22 echo "Running postinst $i..."
23 [ "$POSTINST_LOGGING" = "1" ] && eval echo "Running postinst $i..." $append_log
25 eval sh -c $i $append_log
28 echo "ERROR: postinst $i failed."
29 [ "$POSTINST_LOGGING" = "1" ] && eval echo "ERROR: postinst $i failed." $append_log
36 exec_postinst_scriptlets
38 # since all postinstalls executed successfully, remove the postinstalls directory
39 if [ $remove_agl_pi_dir = 1 ]; then