summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbuild8
-rwxr-xr-xinclude/lib.sh11
-rwxr-xr-xscript/roms5
-rwxr-xr-xscript/trees2
4 files changed, 9 insertions, 17 deletions
diff --git a/build b/build
index d3e86519..dbe7487d 100755
--- a/build
+++ b/build
@@ -21,7 +21,7 @@ err="fail"
main()
{
- [ $# -lt 1 ] && badcmd
+ [ $# -lt 1 ] && $err "bad command"
spath="script/$1"
for g in "which git" "git config --global user.name" \
@@ -35,7 +35,7 @@ main()
inject) shift 1; vendor_inject $@ ;;
download) shift 1; vendor_download $@ ;;
*)
- [ -f "$spath" ] || badcmd
+ [ -f "$spath" ] || $err "bad command"
shift 1; "$spath" $@ || $err "excmd: $spath $@" ;;
esac
set -u -e # some commands disable them. turn them on!
@@ -60,11 +60,11 @@ mkrelease()
vdir="release"
while getopts d:m: option; do
- [ -z "$OPTARG" ] && badcmd "empty argument not allowed"
+ [ -z "$OPTARG" ] && $err "empty argument not allowed"
case "$option" in
d) vdir="$OPTARG" ;;
m) mode="$OPTARG" ;;
- *) badcmd "invalid option '-$option'" ;;
+ *) $err "invalid option '-$option'" ;;
esac
done
diff --git a/include/lib.sh b/include/lib.sh
index 3e137d63..c7c0c38d 100755
--- a/include/lib.sh
+++ b/include/lib.sh
@@ -19,15 +19,6 @@ tmpgit="$PWD/tmp/gitclone"
grubdata="config/data/grub"
err="err_"
-badcmd()
-{
- errmsg="Bad command"
- [ $# -gt 0 ] && errmsg="Bad command ($1)"
-
- dstr="See $projectname build system docs: ${projectsite}docs/maintain/"
- [ -d "docs" ] && dstr="$dstr (local docs available via docs/)"
- $err "$errmsg. $dstr"
-}
err_()
{
printf "ERROR %s: %s\n" "$0" "$1" 1>&2
@@ -59,7 +50,7 @@ read -r projectsite < projectsite || :
install_packages()
{
- [ $# -lt 2 ] && badcmd "fewer than two arguments"
+ [ $# -lt 2 ] && $err "fewer than two arguments"
eval `setcfg "config/dependencies/$2"`
$pkg_add $pkglist || $err "Cannot install packages"
diff --git a/script/roms b/script/roms
index 5cd8b66b..7b6f8685 100755
--- a/script/roms
+++ b/script/roms
@@ -33,8 +33,9 @@ main()
{
while [ $# -gt 0 ]; do
if [ "$1" = "serprog" ]; then
- [ $# -lt 2 ] && badcmd "serprog type not set"
- [ "$2" != "rp2040" ] && [ "$2" != "stm32" ] && badcmd
+ [ $# -lt 2 ] && $err "serprog type not set"
+ [ "$2" != "rp2040" ] && [ "$2" != "stm32" ] && \
+ $err "invalid serprog type"
eval "x_ ./update trees -f \"\${${2}src##*/}\""
ser="$2" && shift 2 && continue
fi
diff --git a/script/trees b/script/trees
index 6a3c1ebd..82c3ce84 100755
--- a/script/trees
+++ b/script/trees
@@ -28,7 +28,7 @@ main()
-s) mode="savedefconfig" ;;
-l) mode="olddefconfig" ;;
-n) mode="nconfig" ;;
- *) badcmd "invalid option '-$option'" ;;
+ *) $err "invalid option '-$option'" ;;
esac
shift; project="${OPTARG#src/}"; shift
done