On Fri, Sep 16, 2011 at 02:39:43PM +0200, Sebastien Luttringer wrote: > 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.
I'm not really sure I see the point of this. Is there a use case other than debugging where this is wanted? d > 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 <[email protected]> > --- > 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 s/need/needs/ s/builded/build/ > + SAVELIST=0 cleanup 0 > else > die "Preset not found: \`%s'" "$PRESET" > fi > -- > Sebastien "Seblu" Luttringer >
