summaryrefslogtreecommitdiff
path: root/lbmk
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-08-23 18:56:31 +0100
committerLeah Rowe <leah@libreboot.org>2023-08-23 19:12:00 +0100
commit57adbc6eb1f961ee9116904b667f30efb3f2de4f (patch)
tree73cff95e43ecbab6db374160ec5657b2853c6826 /lbmk
parentb3fbcdf66eb6225128e2578788e085e1b1eedf34 (diff)
unify err functions across scripts
include/err.sh this new handling also does mundane things, such as tell you what script b0rked Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'lbmk')
-rwxr-xr-xlbmk25
1 files changed, 10 insertions, 15 deletions
diff --git a/lbmk b/lbmk
index f759e461..cab3d4bd 100755
--- a/lbmk
+++ b/lbmk
@@ -24,6 +24,8 @@
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
+. "include/err.sh"
+
projectname="$(cat projectname)"
buildpath=""
mode=""
@@ -31,8 +33,8 @@ option=""
main()
{
- [ "${0##*/}" = "lbmk" ] && die "Don't run this script directly."
- [ $# -lt 1 ] && die "Too few arguments. Try: ${0} help"
+ [ "${0##*/}" = "lbmk" ] && err "Don't run this script directly."
+ [ $# -lt 1 ] && err "Too few arguments. Try: ${0} help"
buildpath="./resources/scripts/${0##*/}"
@@ -41,7 +43,7 @@ main()
[ "${mode}" = "help" ] && usage ${0} && exit 0
[ $# -lt 2 ] && usage ${0} && exit 1
if [ "${mode}" = "dependencies" ]; then
- install_dependencies $@ || die "Could not install dependencies"
+ install_dependencies $@ || err "Could not install dependencies"
exit 0
else
./resources/scripts/misc/versioncheck
@@ -62,13 +64,13 @@ main()
*)
if [ ! -d "${buildpath}/${mode}" ]; then
usage $0
- die "Invalid mode '${mode}'. Run: ${0} help"
+ err "Invalid mode '${mode}'. Run: ${0} help"
elif [ ! -f "${buildpath}/${mode}/${option}" ]; then
usage $0
printf "Invalid option for '%s'." ${mode}
- die "Run: ${0} ${mode} list'."
+ err "Run: ${0} ${mode} list'."
fi
- "${buildpath}/${mode}/${option}" $@ || die "lbmk error"
+ "${buildpath}/${mode}/${option}" $@ || err "lbmk error"
esac
./.gitcheck clean
@@ -76,12 +78,12 @@ main()
install_dependencies()
{
- [ -f "resources/dependencies/${2}" ] || die "Unsupported target"
+ [ -f "resources/dependencies/${2}" ] || err "Unsupported target"
aur_notice=""
. "resources/dependencies/${2}"
- ${pkg_add} ${pkglist} || die "Error installing dependencies"
+ ${pkg_add} ${pkglist} || err "Error installing dependencies"
[ "${aur_notice}" != "" ] && \
printf "You must install these AUR packages: %s\n" \
"${aur_notice}" 1>&2
@@ -120,11 +122,4 @@ listmodes()
done
}
-die()
-{
- ./.gitcheck clean
- printf "Error: %s\n" "${@}" 1>&2
- exit 1
-}
-
main $@