mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-26 11:41:35 +01:00
run: use getopt
This commit is contained in:
59
common
59
common
@@ -26,41 +26,60 @@ common_bench_cmd() (
|
||||
|
||||
|
||||
# Handle options common across multiple scripts.
|
||||
common_getopts_case() {
|
||||
common_getopt_case() {
|
||||
case "$1" in
|
||||
a)
|
||||
common_arch="$OPTARG"
|
||||
-a|--arch)
|
||||
common_arch="$2"
|
||||
shift 2
|
||||
;;
|
||||
g)
|
||||
-g|--gem5)
|
||||
common_gem5=true
|
||||
shift
|
||||
;;
|
||||
L)
|
||||
common_linux_variant="$OPTARG"
|
||||
-L|--linux-variant)
|
||||
common_linux_variant="$2"
|
||||
shift 2
|
||||
;;
|
||||
M)
|
||||
common_gem5_variant="$OPTARG"
|
||||
-M|--gem5-variant)
|
||||
common_gem5_variant="$2"
|
||||
shift 2
|
||||
;;
|
||||
N)
|
||||
common_gem5_worktree="$OPTARG"
|
||||
-N|--gem5-worktree)
|
||||
common_gem5_worktree="$2"
|
||||
shift 2
|
||||
;;
|
||||
n)
|
||||
common_run_id="$OPTARG"
|
||||
-n|--run-id)
|
||||
common_run_id="$2"
|
||||
shift 2
|
||||
;;
|
||||
Q)
|
||||
common_qemu_variant="$OPTARG"
|
||||
-Q|--qemu-variant)
|
||||
common_qemu_variant="$2"
|
||||
shift 2
|
||||
;;
|
||||
s)
|
||||
common_suffix="$OPTARG"
|
||||
-s|--suffix)
|
||||
common_suffix="$2"
|
||||
shift 2
|
||||
;;
|
||||
t)
|
||||
common_gem5_build_type="$OPTARG"
|
||||
-t|--gem5-build-type)
|
||||
common_gem5_build_type="$2"
|
||||
shift 2
|
||||
;;
|
||||
?)
|
||||
*)
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
}
|
||||
common_getopts_flags='a:gL:M:N:n:Q:s:t:'
|
||||
common_getopt_flags='a:gL:M:N:n:Q:s:t:'
|
||||
common_getopt_flags_long="\
|
||||
arch:,\
|
||||
gem5,\
|
||||
linux-variant:,\
|
||||
gem5-variant:,\
|
||||
gem5-worktree:,\:
|
||||
qemu-variant:,\
|
||||
suffix:,\
|
||||
gem5-build-type:'
|
||||
"
|
||||
|
||||
# Setup several variables and do other initialization common to most scripts.
|
||||
# Typically done after getting inputs from the command line arguments.
|
||||
|
||||
Reference in New Issue
Block a user