diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-09-10 19:56:36 +0100 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-09-10 19:56:36 +0100 |
| commit | 005f1189c150ad7168006533bc66d97cc22b42c1 (patch) | |
| tree | 6adadb12bb66806b6f81b085d1fe67054b8c6ac5 /mk | |
| parent | 86781a58810f8a4a1e124ba52c0c0763949484dc (diff) | |
mk: major code cleanup
we don't need a main here. it's so generic that we
can just leave it really small like it is now. now
it's much clearer what it actually does.
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'mk')
| -rwxr-xr-x | mk | 33 |
1 files changed, 11 insertions, 22 deletions
@@ -11,36 +11,25 @@ xrval=0 ( xbarg0="$0" -if [ "${xbarg0##*/}" = "$xbarg0" ]; then - xbarg0="`command -v "$xbarg0"`" -fi +[ "${xbarg0##*/}" = "$xbarg0" ] && \ + xbarg0="`command -v "$xbarg0"`" -xbcddir="`readlink -f "$xbarg0" 2>/dev/null`" -if [ -z "$xbcddir" ]; then - xbcddir="`realpath "$xbarg0" 2>/dev/null`" -fi -xbcddir="${xbcddir%/*}" +commandv="`readlink -f "$xbarg0" 2>/dev/null`" +[ -z "$commandv" ] && \ + commandv="`realpath "$xbarg0" 2>/dev/null`" -cd "$xbcddir" || exit 1 +cd "${commandv%/*}" || exit 1 . "include/common.sh" -main() -{ - cmd="${1-}" - [ $# -gt 0 ] && shift 1 - - if ! xeq main "$cmd" $xbcommands; then - return 0 - fi +if xeq main "${1-}" \ + $xbcommands; then - $cmd "$@" + "$@" set -u -e - return 1 -} - -main "$@" || exit 0 + exit 0 +fi . "include/tree.sh" |
