diff options
author | Jean Delvare <jdelvare@suse.de> | 2014-12-18 17:06:16 +0100 |
---|---|---|
committer | Jean Delvare <jdelvare@suse.de> | 2014-12-18 17:06:16 +0100 |
commit | 8fc366ebc7d13918f10e9eda473329906778343e (patch) | |
tree | 202f9c98f2895e2b6069d3d18e3829bad1a1b1c1 | |
parent | c0f677497b760028ae8aafb72d4d08604aa7870e (diff) | |
download | quilt-8fc366ebc7d13918f10e9eda473329906778343e.tar.gz |
setup: Merge tests
Don't test the same condition twice in a row, it's inefficient.
-rw-r--r-- | quilt/setup.in | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/quilt/setup.in b/quilt/setup.in index 639d40d..df76368 100644 --- a/quilt/setup.in +++ b/quilt/setup.in @@ -284,39 +284,40 @@ case "$1" in ;; esac -# Make sure that unpacking will not overwrite anything -[ -n "$opt_fast" ] || \ -check_for_existing_directories || exit 1 +if [ -z "$opt_fast" ] +then + # Make sure that unpacking will not overwrite anything + check_for_existing_directories || exit 1 -[ -n "$opt_fast" ] || \ -while read tag dir arg1 arg2 -do - case "$tag" in - tar) - tarball=$sourcedir$arg1 - if [ ! -e "$tarball" ] - then - printf $"File %s not found\n" "$tarball" >&2 - exit 1 - fi - printf $"Unpacking archive %s\n" "$tarball" - mkdir -p "${prefix:-.}" "$prefix$dir" - cat_file "$tarball" \ - | tar xf - -C "$prefix$dir" - ;; - unzip) - tarball=$sourcedir$arg1 - if [ ! -e "$tarball" ] - then - printf $"File %s not found\n" "$tarball" >&2 - exit 1 - fi - printf $"Unpacking archive %s\n" "$tarball" - mkdir -p "${prefix:-.}" "$prefix$dir" - unzip -qqo "$tarball" -d "$prefix$dir" - ;; - esac -done < $tmpfile + while read tag dir arg1 arg2 + do + case "$tag" in + tar) + tarball=$sourcedir$arg1 + if [ ! -e "$tarball" ] + then + printf $"File %s not found\n" "$tarball" >&2 + exit 1 + fi + printf $"Unpacking archive %s\n" "$tarball" + mkdir -p "${prefix:-.}" "$prefix$dir" + cat_file "$tarball" \ + | tar xf - -C "$prefix$dir" + ;; + unzip) + tarball=$sourcedir$arg1 + if [ ! -e "$tarball" ] + then + printf $"File %s not found\n" "$tarball" >&2 + exit 1 + fi + printf $"Unpacking archive %s\n" "$tarball" + mkdir -p "${prefix:-.}" "$prefix$dir" + unzip -qqo "$tarball" -d "$prefix$dir" + ;; + esac + done < $tmpfile +fi if ! check_for_existing_files then |