[arch-projects] [MKINITCPIO][PATCH] Fix save build directory with presets
Current behaviour of -s option of mkinitcpio is bad when presets are used. mkinitcpio saves main process build directory which is always empty when preset option is used. mkinitcpio doesn't save preset sub processes build directories which is the expected behaviour. This patch fix the two previous points by: - inherit -s parameter inside preset sub processes. - force main process (in case of preset) to clean build directory Signed-off-by: Sebastien Luttringer <seblu@seblu.net> --- mkinitcpio | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mkinitcpio b/mkinitcpio index 49dabbd..53254d7 100755 --- a/mkinitcpio +++ b/mkinitcpio @@ -64,7 +64,7 @@ cleanup () { if [[ $TMPDIR ]]; then if (( $SAVELIST )); then - msg "build directory saved in %s" "$TMPDIR" + msg "Build directory saved in %s" "$TMPDIR" else rm -rf "$TMPDIR" fi @@ -198,6 +198,7 @@ if [[ $PRESET ]]; then # Use -b, -m and -v options specified earlier declare -a preset_mkopts preset_cmd [[ $BASEDIR ]] && preset_mkopts+=(-b "$BASEDIR") + (( SAVELIST )) && preset_mkopts+=(-s) (( QUIET )) || preset_mkopts+=(-v) # Build all images . "$PRESET" @@ -237,7 +238,8 @@ if [[ $PRESET ]]; then msg2 "${preset_cmd[*]}" "$0" "${preset_cmd[@]}" done - cleanup 0 + # Main process never need to keep builded directory + SAVELIST=0 cleanup 0 else die "Preset not found: \`%s'" "$PRESET" fi -- Sebastien "Seblu" Luttringer
participants (1)
-
Sebastien Luttringer