From 41f0cda5587bddc773230210a2825d9907401f2e Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Wed, 6 May 2015 22:37:54 +0200 Subject: [PATCH] patchinstall.sh: Simplify code to enable/disable patchsets. --- debian/tools/patchinstall.sh.in | 29 +++++++++++------------------ patches/patchinstall.sh | 29 +++++++++++------------------ 2 files changed, 22 insertions(+), 36 deletions(-) diff --git a/debian/tools/patchinstall.sh.in b/debian/tools/patchinstall.sh.in index 191390b8..74bb3b33 100644 --- a/debian/tools/patchinstall.sh.in +++ b/debian/tools/patchinstall.sh.in @@ -80,7 +80,6 @@ enable_patchlist=1 enable_autoconf=1 patchlist="/dev/null" backend="patch" -enable=1 # Find location of patches patchdir="$(dirname "$(readlink -f "$0")")" @@ -98,16 +97,6 @@ if test "$#" -eq 0; then fi while test "$#" -gt 0; do - if patch_enable "$1" "$enable"; then - shift - enable=1 - continue - fi - - if test "$enable" -ne 1; then - abort "Wrong use of -W commandline argument, expected patchname." - fi - case "$1" in DESTDIR=*) DESTDIR="${{1#*=}}" @@ -150,20 +139,24 @@ while test "$#" -gt 0; do ;; -W) - enable=2 + # Disable patchset + if ! patch_enable "$2" 2; then + abort "Wrong usage of -W commandline argument, expected patchname." + fi + shift shift ;; *) - abort "Unknown commandline argument $1" - exit 1 + # Enable patchset + if ! patch_enable "$1" 1; then + abort "Unknown commandline argument $1." + fi + shift + ;; esac done -if test "$enable" -ne 1; then - abort "Missing argument for -W, expected patchname." -fi - # Determine DESTDIR if not explicitly specified if test -z "$DESTDIR" -a -f ./tools/make_requests; then DESTDIR="$(pwd)" diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index aa5590d6..e1a3f257 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -878,7 +878,6 @@ enable_patchlist=1 enable_autoconf=1 patchlist="/dev/null" backend="patch" -enable=1 # Find location of patches patchdir="$(dirname "$(readlink -f "$0")")" @@ -896,16 +895,6 @@ if test "$#" -eq 0; then fi while test "$#" -gt 0; do - if patch_enable "$1" "$enable"; then - shift - enable=1 - continue - fi - - if test "$enable" -ne 1; then - abort "Wrong use of -W commandline argument, expected patchname." - fi - case "$1" in DESTDIR=*) DESTDIR="${1#*=}" @@ -948,20 +937,24 @@ while test "$#" -gt 0; do ;; -W) - enable=2 + # Disable patchset + if ! patch_enable "$2" 2; then + abort "Wrong usage of -W commandline argument, expected patchname." + fi + shift shift ;; *) - abort "Unknown commandline argument $1" - exit 1 + # Enable patchset + if ! patch_enable "$1" 1; then + abort "Unknown commandline argument $1." + fi + shift + ;; esac done -if test "$enable" -ne 1; then - abort "Missing argument for -W, expected patchname." -fi - # Determine DESTDIR if not explicitly specified if test -z "$DESTDIR" -a -f ./tools/make_requests; then DESTDIR="$(pwd)"