Hi I have tested the following and it seems to work. Full patch attached.
Regards, // Ola -- --------------------- Ola Lundqvist --------------------------- / [EMAIL PROTECTED] Annebergsslingan 37 \ | [EMAIL PROTECTED] 654 65 KARLSTAD | | http://opalsys.net/ +46 (0)70-332 1551 | \ gpg/f.p.: 7090 A92B 18FE 7994 0C36 4FE4 18A1 B1CF 0FE5 3DD9 / ---------------------------------------------------------------
Index: cron-apt =================================================================== --- cron-apt (revision 2437) +++ cron-apt (arbetskopia) @@ -22,6 +22,12 @@ # MA 02110-1301 USA. # # Changes: +# 2007-08-02 Ola Lundqvist <[EMAIL PROTECTED]> +# Added support for *_HERE variables in the action.d files. +# They are copied to the * variable before the action loop +# and then restored in the end of the loop. +# Marc Haber gave the idea to have variables that are applicable +# for only the action item. # 2007-08-01 Ola Lundqvist <[EMAIL PROTECTED]> # Changed so that the tmp size checking is done later. # 2007-07-31 Ola Lundqvist <[EMAIL PROTECTED]> @@ -412,6 +418,37 @@ done; } +general_varmove() { + PREFIX=$1 + STORE=$2 + SIFS=$IFS + IFS=" +" + LIST=$(set | grep "^[a-zA-Z][a-zA-Z0-9_]*_$PREFIX" | sed -e "s|=.*||;") + for PVAR in $* ; do + # Var name + VVAR=$(echo $PVAR | sed -e "s|_$PREFIX$||g;") + if [ -n "$STORE" ] ; then + # Stored var name + eval "SVAR=${VVAR}_$STORE" + # Store the value + eval "$SVAR=\$$VAR" + fi + # Set variable to here variable + eval "$VVAR=\$$PVAR" + eval "unset $PVAR" + done + IFS=$SIFS +} + +herevariables_store() { + general_varmove HERE STORED +} + +herevariables_restore() { + general_varmove STORED "" +} + ############################### check ######################################### if ! [ -d "$LIBDIR/$CONFIGDIRNAME" ]; then @@ -489,6 +526,7 @@ echo "CRON-APT ACTION: $ACTIONF" > "$ACTIONMAIL" echo "CRON-APT ACTION: $ACTIONF" > "$ACTIONLOG" echo "CRON-APT ACTION: $ACTIONF" > "$ACTIONSYSLOG" + herevariables_store cat "$ACTIONDIR/$ACTIONF" | \ sed -e "s/#.*$//;" | \ grep -v "^[[:space:]]*$" | { @@ -623,6 +661,7 @@ fi rm -f "$STATUS" fi + herevariables_restore done onexit