[arch-projects] [mkinitcpio] [PATCH 2/3] mkinitcpio: Improve output when -T option is used.

Dave Reisner d at falconindy.com
Mon Nov 18 22:17:36 EST 2013


On Mon, Nov 18, 2013 at 08:21:47PM +0100, Thomas Bächler wrote:
> ---
>  mkinitcpio | 24 ++++++++++++++----------
>  1 file changed, 14 insertions(+), 10 deletions(-)
> 
> diff --git a/mkinitcpio b/mkinitcpio
> index 489e199..16f1b98 100755
> --- a/mkinitcpio
> +++ b/mkinitcpio
> @@ -444,19 +444,21 @@ if (( _optshowautomods )); then
>      cleanup 0
>  fi
>  
> -if [[ -z $_optgenimg ]]; then
> +if [[ ( -z $_optgenimg && -z $_optsavetree ) ]]; then

Did you mean to check $_opttargetdir rather than $_optsavetree?

>      msg "Starting dry run: %s" "$KERNELVERSION"
>  else

I think you save yourself some patch noise by making this an elif on the
$_optgenimg conditional.

> -    # check for permissions. if the image doesn't already exist,
> -    # then check the directory
> -    if [[ ( -e $_optgenimg && ! -w $_optgenimg ) ||
> -            ( ! -d ${_optgenimg%/*} || ! -w ${_optgenimg%/*} ) ]]; then
> -        die 'Unable to write to %s' "$_optgenimg"
> -    fi
> +    if [[ $_optgenimg ]]; then
> +        # check for permissions. if the image doesn't already exist,
> +        # then check the directory
> +        if [[ ( -e $_optgenimg && ! -w $_optgenimg ) ||
> +                ( ! -d ${_optgenimg%/*} || ! -w ${_optgenimg%/*} ) ]]; then
> +            die 'Unable to write to %s' "$_optgenimg"
> +        fi
>  
> -    _optcompress=${_optcompress:-${COMPRESSION:-gzip}}
> -    if ! type -P "$_optcompress" >/dev/null; then
> -        die "Unable to locate compression method: %s" "$_optcompress"
> +        _optcompress=${_optcompress:-${COMPRESSION:-gzip}}
> +        if ! type -P "$_optcompress" >/dev/null; then
> +            die "Unable to locate compression method: %s" "$_optcompress"
> +        fi
>      fi
>  
>      msg "Starting build: %s" "$KERNELVERSION"
> @@ -498,6 +500,8 @@ ldconfig -r "$BUILDROOT" &>/dev/null
>  
>  if [[ $_optgenimg ]]; then
>      build_image "$_optgenimg" "$_optcompress"
> +elif [[ $_optsavetree ]]; then
> +    msg "Build complete."

Maybe reaffirm the output directory here?

>  else
>      msg "Dry run complete, use -g IMAGE to generate a real image"
>  fi
> -- 
> 1.8.4.2
> 


More information about the arch-projects mailing list