summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-09-26 01:34:10 +0100
committerLeah Rowe <leah@libreboot.org>2023-09-26 01:35:15 +0100
commit67f4919ffefdc2a95af95e86cc01b998df292b4b (patch)
treeb30b50166bdea39c27948120426f0795ae7e7f98
parent36b7f01a8a1bf2d31f3163d64a96aa49a98d0d62 (diff)
simplify getopts loops in shell scripts
Signed-off-by: Leah Rowe <leah@libreboot.org>
-rwxr-xr-xscript/handle/make/config26
-rwxr-xr-xscript/handle/make/file13
-rwxr-xr-xscript/update/blobs/inject11
3 files changed, 15 insertions, 35 deletions
diff --git a/script/handle/make/config b/script/handle/make/config
index 81169953..9ae85a0e 100755
--- a/script/handle/make/config
+++ b/script/handle/make/config
@@ -38,26 +38,14 @@ main()
while getopts b:m:u:c:x: option
do
case "${1}" in
- -b)
- mode="all"
- shift ;;
- -u)
- mode="oldconfig"
- shift ;;
- -m)
- mode="menuconfig"
- shift ;;
- -c)
- mode="distclean"
- shift ;;
- -x)
- mode="crossgcc-clean"
- shift ;;
- *)
- fail "Invalid option" ;;
+ -b) mode="all" ;;
+ -u) mode="oldconfig" ;;
+ -m) mode="menuconfig" ;;
+ -c) mode="distclean" ;;
+ -x) mode="crossgcc-clean" ;;
+ *) fail "Invalid option" ;;
esac
- project="${OPTARG}"
- shift
+ shift; project="${OPTARG}"; shift
done
[ -z "${mode}" ] && fail "mode not given (-m, -u or -b)"
diff --git a/script/handle/make/file b/script/handle/make/file
index 3d485ea2..0d0d6f3c 100755
--- a/script/handle/make/file
+++ b/script/handle/make/file
@@ -15,16 +15,11 @@ main()
while getopts b:c: option
do
case "${1}" in
- -b)
- shift ;;
- -c)
- mode="distclean"
- shift ;;
- *)
- err "Invalid option" ;;
+ -b) : ;;
+ -c) mode="distclean" ;;
+ *) err "Invalid option" ;;
esac
- project="${OPTARG}"
- shift
+ shift; project="${OPTARG}"; shift
done
[ -z "${project}" ] && err "project name not specified"
diff --git a/script/update/blobs/inject b/script/update/blobs/inject
index aae7b0cc..c2f9ead6 100755
--- a/script/update/blobs/inject
+++ b/script/update/blobs/inject
@@ -23,13 +23,10 @@ main()
while getopts r:b:m: option
do
case "${option}" in
- r)
- rom=${OPTARG} ;;
- b)
- board=${OPTARG} ;;
- m)
- modifygbe=true
- new_mac=${OPTARG} ;;
+ r) rom=${OPTARG} ;;
+ b) board=${OPTARG} ;;
+ m) modifygbe=true
+ new_mac=${OPTARG} ;;
esac
done