diff options
author | Dave Reisner <dreisner@archlinux.org> | 2012-05-11 17:18:02 +0200 |
---|---|---|
committer | Dave Reisner <dreisner@archlinux.org> | 2012-05-16 23:55:54 +0200 |
commit | 799ca0ab2dfb509f152fe268dfc916df2d33cbd1 (patch) | |
tree | 2365bde8da67501e453e6045e00a458a66c322d2 | |
parent | fdc89d71aae5d8b7449281fd62a681bf9552b54f (diff) | |
download | mkinitcpio-799ca0ab2dfb509f152fe268dfc916df2d33cbd1.tar.gz mkinitcpio-799ca0ab2dfb509f152fe268dfc916df2d33cbd1.tar.xz |
move -g option checking to parseopts loop
Avoid any delay in checking this option, as it only serves to fragment
the logic.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
-rwxr-xr-x | mkinitcpio | 14 |
1 files changed, 5 insertions, 9 deletions
@@ -154,7 +154,10 @@ while :; do SAVELIST=1 ;; -g|--generate) shift - GENIMG=$1 ;; + [[ -d $1 ]] && die "Invalid image path -- must not be a directory" + if ! GENIMG=$(readlink -f "$1") || [[ ! -e ${GENIMG%/*} ]]; then + die "Unable to write to path: \`%s'" "$1" + fi ;; -h|--help) usage cleanup 0 ;; @@ -304,13 +307,6 @@ if [[ $PRESET ]]; then fi fi -if [[ $GENIMG ]]; then - IMGPATH=$(readlink -f "$GENIMG") - if [[ -z $IMGPATH || ! -w ${IMGPATH%/*} ]]; then - die "Unable to write to path: \`%s'" "$GENIMG" - fi -fi - if [[ ! -f $CONFIG ]]; then die "Config file does not exist: \`%s'" "$CONFIG" fi @@ -441,7 +437,7 @@ if [[ $GENIMG ]]; then pushd "$BUILDROOT" >/dev/null find . -print0 | bsdcpio $( (( QUIET )) && echo '--quiet' ) -R 0:0 -0oH newc | - $COMPRESSION $COMPRESSION_OPTIONS > "$IMGPATH" + $COMPRESSION $COMPRESSION_OPTIONS > "$GENIMG" pipesave=("${PIPESTATUS[@]}") # save immediately popd >/dev/null |