summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
Diffstat (limited to 'mk')
-rwxr-xr-xmk45
1 files changed, 37 insertions, 8 deletions
diff --git a/mk b/mk
index f358bc3a..53de360c 100755
--- a/mk
+++ b/mk
@@ -1,11 +1,21 @@
#!/usr/bin/env sh
+
# SPDX-License-Identifier: GPL-3.0-or-later
+
# Copyright (c) 2020-2025 Leah Rowe <leah@libreboot.org>
# Copyright (c) 2022 Caleb La Grange <thonkpeasant@protonmail.com>
set -u -e
-if [ "./${0##*/}" != "${0}" ] || [ ! -f "mk" ] || [ -L "mk" ]; then
+ispwd="true"
+
+if [ "$0" != "./mk" ]; then
+ ispwd="false"
+fi
+if [ "$ispwd" = "true" ] && [ -L "mk" ]; then
+ ispwd="false"
+fi
+if [ "$ispwd" = "false" ]; then
printf "You must run this in the proper work directory.\n" 1>&2
exit 1
fi
@@ -13,23 +23,39 @@ fi
. "include/lib.sh"
. "include/init.sh"
. "include/vendor.sh"
-. "include/inject.sh"
. "include/mrc.sh"
+. "include/inject.sh"
. "include/rom.sh"
. "include/release.sh"
. "include/get.sh"
main()
{
- cmd="" && [ $# -gt 0 ] && cmd="$1" && shift 1
+ cmd=""
+ if [ $# -gt 0 ]; then
+ cmd="$1"
+
+ shift 1
+ fi
case "$cmd" in
- version) printf "%s\nWebsite: %s\n" "$relname" "$projectsite" ;;
- release|download|inject) $cmd "$@" ;;
- -*) return 0 ;;
- *) err "bad command" ;;
+ version)
+ printf "%s\nWebsite: %s\n" "$relname" "$projectsite"
+ ;;
+ release|download|inject)
+ $cmd "$@"
+ ;;
+ -*)
+ return 0
+ ;;
+ *)
+ err "bad command" main "$@"
+ ;;
esac
- set -u -e # some commands disable them. turn them on!
+
+ # some commands disable them. turn them back on!
+ set -u -e
+
return 1
}
@@ -38,5 +64,8 @@ main "$@" || exit 0
. "include/tree.sh"
trees "$@" || exit 0
+
+x_ touch "$mkhelpercfg"
+
. "$mkhelpercfg"
$cmd