Skip to content

Commit ea7beb7

Browse files
committed
cmd-buildextend-metal: set variables at top of main
And also refactor to drop the rc variable.
1 parent b01866e commit ea7beb7

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/cmd-buildextend-metal

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ EOF
187187

188188

189189
main() {
190+
# Set Some Defaults
191+
genprotimgvm=/data.secex/genprotimgvm.qcow2
192+
build=
193+
force=
190194

191195
# This script is used for creating several artifacts. For example,
192196
# `cmd-buildextend-qemu` is a symlink to `cmd-buildextend-metal`.
@@ -199,13 +203,7 @@ main() {
199203
*) fatal "called as unexpected name $0";;
200204
esac
201205

202-
# Parse options
203-
genprotimgvm=/data.secex/genprotimgvm.qcow2
204-
rc=0
205-
build=
206-
force=
207-
options=$(getopt --options h --longoptions help,force,build:,genprotimgvm: -- "$@") || rc=$?
208-
[ $rc -eq 0 ] || {
206+
options=$(getopt --options h --longoptions help,force,build:,genprotimgvm: -- "$@") || {
209207
print_help
210208
exit 1
211209
}

0 commit comments

Comments
 (0)