From c7dae5343c58dc6b2c55445734e456b365065de4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ozan=20=C3=87a=C4=9Flayan?= Date: Tue, 21 Aug 2012 19:34:51 +0300 Subject: [PATCH] compat-drivers: Use case instead of if/if/.. blocks MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit case is much cleaner both for reading and for extending. Signed-off-by: Ozan Çağlayan Signed-off-by: Luis R. Rodriguez --- scripts/admin-update.sh | 71 +++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 34 deletions(-) diff --git a/scripts/admin-update.sh b/scripts/admin-update.sh index 22365cddad86..69b52873facb 100755 --- a/scripts/admin-update.sh +++ b/scripts/admin-update.sh @@ -205,41 +205,44 @@ if [ $# -ge 1 ]; then usage $0 exit fi - if [[ $1 = "-h" || $1 = "--help" ]]; then - usage $0 - exit - fi while [ $# -ne 0 ]; do - if [[ "$1" = "-s" ]]; then - GET_STABLE_PENDING="y" - EXTRA_PATCHES="${EXTRA_PATCHES} pending-stable" - EXTRA_PATCHES="${EXTRA_PATCHES} pending-stable/backports/" - POSTFIX_RELEASE_TAG="${POSTFIX_RELEASE_TAG}s" - shift; continue; - fi - if [[ "$1" = "-n" ]]; then - EXTRA_PATCHES="${EXTRA_PATCHES} linux-next-cherry-picks" - POSTFIX_RELEASE_TAG="${POSTFIX_RELEASE_TAG}n" - shift; continue; - fi - if [[ "$1" = "-p" ]]; then - EXTRA_PATCHES="${EXTRA_PATCHES} linux-next-pending" - POSTFIX_RELEASE_TAG="${POSTFIX_RELEASE_TAG}p" - shift; continue; - fi - if [[ "$1" = "-c" ]]; then - EXTRA_PATCHES="${EXTRA_PATCHES} crap" - POSTFIX_RELEASE_TAG="${POSTFIX_RELEASE_TAG}c" - shift; continue; - fi - if [[ "$1" = "refresh" ]]; then - REFRESH="y" - shift; continue; - fi - - echo "Unexpected argument passed: $1" - usage $0 - exit + case $1 in + "-s") + GET_STABLE_PENDING="y" + EXTRA_PATCHES="${EXTRA_PATCHES} pending-stable" + EXTRA_PATCHES="${EXTRA_PATCHES} pending-stable/backports/" + POSTFIX_RELEASE_TAG="${POSTFIX_RELEASE_TAG}s" + shift + ;; + "-n") + EXTRA_PATCHES="${EXTRA_PATCHES} linux-next-cherry-picks" + POSTFIX_RELEASE_TAG="${POSTFIX_RELEASE_TAG}n" + shift + ;; + "-p") + EXTRA_PATCHES="${EXTRA_PATCHES} linux-next-pending" + POSTFIX_RELEASE_TAG="${POSTFIX_RELEASE_TAG}p" + shift + ;; + "-c") + EXTRA_PATCHES="${EXTRA_PATCHES} crap" + POSTFIX_RELEASE_TAG="${POSTFIX_RELEASE_TAG}c" + shift + ;; + "refresh") + REFRESH="y" + shift + ;; + "-h" | "--help") + usage $0 + exit + ;; + *) + echo "Unexpected argument passed: $1" + usage $0 + exit + ;; + esac done fi -- 2.30.2