mk: unroll condensed code lines

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2025-09-24 08:53:24 +01:00
parent 0275c60111
commit 03bf6c185b
+34 -9
View File
@@ -6,8 +6,15 @@
set -u -e set -u -e
ispwd="true" ispwd="true"
[ "$0" = "./mk" ] || ispwd="false"
[ "$ispwd" = "true" ] && [ -L "mk" ] && ispwd="false" if [ "$0" != "./mk" ]; then
ispwd="false"
fi
if [ "$ispwd" = "true" ] && [ -L "mk" ]; then
ispwd="false"
fi
if [ "$ispwd" = "false" ]; then if [ "$ispwd" = "false" ]; then
printf "You must run this in the proper work directory.\n" 1>&2 printf "You must run this in the proper work directory.\n" 1>&2
exit 1 exit 1
@@ -24,22 +31,40 @@ fi
main() main()
{ {
cmd="" && [ $# -gt 0 ] && cmd="$1" && shift 1 cmd=""
if [ $# -gt 0 ]; then
cmd="$1"
shift 1
fi
case "$cmd" in case "$cmd" in
version) printf "%s\nWebsite: %s\n" "$relname" "$projectsite" ;; version)
release|download|inject) $cmd "$@" ;; printf "%s\nWebsite: %s\n" "$relname" "$projectsite"
-*) return 1 ;; ;;
*) err "bad command" main "$@" ;; release|download|inject)
$cmd "$@"
;;
-*)
return 0
;;
*)
err "bad command" main "$@"
;;
esac esac
set -u -e # some commands disable them. turn them on!
# some commands disable them. turn them back on!
set -u -e
return 1
} }
main "$@" && exit 0 main "$@" || exit 0
. "include/tree.sh" . "include/tree.sh"
trees "$@" || exit 0 trees "$@" || exit 0
x_ touch "$mkhelpercfg" x_ touch "$mkhelpercfg"
. "$mkhelpercfg" . "$mkhelpercfg"
$cmd $cmd