mirror of
https://codeberg.org/canoeboot/cbmk.git
synced 2025-01-09 16:49:54 +00:00
8badcf1cf4
Signed-off-by: Leah Rowe <info@minifree.org>
46 lines
1 KiB
Bash
Executable file
46 lines
1 KiB
Bash
Executable file
#!/usr/bin/env sh
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
# Copyright (c) 2014-2015,2020-2024 Leah Rowe <leah@libreboot.org>
|
|
# Copyright (c) 2015 Patrick "P. J." McDermott <pj@pehjota.net>
|
|
# Copyright (c) 2015-2016 Klemens Nanni <contact@autoboot.org>
|
|
# Copyright (c) 2022 Caleb La Grange <thonkpeasant@protonmail.com>
|
|
|
|
set -u -e
|
|
|
|
. "include/lib.sh"
|
|
|
|
mode=""
|
|
err="fail"
|
|
|
|
linkpath="${0}"
|
|
linkname="${linkpath##*/}"
|
|
|
|
main()
|
|
{
|
|
[ $# -lt 1 ] && $err "too few arguments"
|
|
spath="script/$1"
|
|
|
|
for g in "which git" "git config --global user.name" \
|
|
"git config --global user.email"; do
|
|
eval "$g 1>/dev/null 2>/dev/null || \$err \"unset: $g\""
|
|
done
|
|
|
|
[ -f "$spath" ] || $err "bad command"
|
|
shift 1; "$spath" $@ || $err "excmd: $spath $@"
|
|
}
|
|
|
|
fail()
|
|
{
|
|
tmp_cleanup || printf "WARNING: can't rm tmpfiles: %s\n" "$tmpdir" 1>&2
|
|
err_ "${1}"
|
|
}
|
|
|
|
tmp_cleanup()
|
|
{
|
|
[ "$tmpdir_was_set" = "n" ] || return 0
|
|
rm -Rf "$tmpdir" || return 1
|
|
rm -f lock || return 1
|
|
}
|
|
|
|
main $@
|
|
tmp_cleanup || err_ "can't rm tmpdir upon non-zero exit: $tmpdir"
|