lib.sh: remove badcmd()
it's bloat. telling the user to rtfm is something that we already do on irc; they will still ask how to do everything, and ignore the message from badcmd(), or they will automatically know to rtfm. i'm on a massive purge, removing bloat from lbmk as part of Libreboot Build System Audit 6. all bloat must go. Signed-off-by: Leah Rowe <leah@libreboot.org>audit2
parent
dec9ae9b43
commit
e7fcfac14e
8
build
8
build
|
@ -19,7 +19,7 @@ err="fail"
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
[ $# -lt 1 ] && badcmd
|
[ $# -lt 1 ] && $err "bad command"
|
||||||
spath="script/$1"
|
spath="script/$1"
|
||||||
|
|
||||||
for g in "which git" "git config --global user.name" \
|
for g in "which git" "git config --global user.name" \
|
||||||
|
@ -31,7 +31,7 @@ main()
|
||||||
version) printf "%s\nWebsite: %s\n" "$relname" "$projectsite" ;;
|
version) printf "%s\nWebsite: %s\n" "$relname" "$projectsite" ;;
|
||||||
release) shift 1; mkrelease $@ ;;
|
release) shift 1; mkrelease $@ ;;
|
||||||
*)
|
*)
|
||||||
[ -f "$spath" ] || badcmd
|
[ -f "$spath" ] || $err "bad command"
|
||||||
shift 1; "$spath" $@ || $err "excmd: $spath $@" ;;
|
shift 1; "$spath" $@ || $err "excmd: $spath $@" ;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
@ -55,11 +55,11 @@ mkrelease()
|
||||||
|
|
||||||
vdir="release"
|
vdir="release"
|
||||||
while getopts d:m: option; do
|
while getopts d:m: option; do
|
||||||
[ -z "$OPTARG" ] && badcmd "empty argument not allowed"
|
[ -z "$OPTARG" ] && $err "empty argument not allowed"
|
||||||
case "$option" in
|
case "$option" in
|
||||||
d) vdir="$OPTARG" ;;
|
d) vdir="$OPTARG" ;;
|
||||||
m) mode="$OPTARG" ;;
|
m) mode="$OPTARG" ;;
|
||||||
*) badcmd "invalid option '-$option'" ;;
|
*) $err "invalid option '-$option'" ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -19,15 +19,6 @@ tmpgit="$PWD/tmp/gitclone"
|
||||||
grubdata="config/data/grub"
|
grubdata="config/data/grub"
|
||||||
err="err_"
|
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_()
|
err_()
|
||||||
{
|
{
|
||||||
printf "ERROR %s: %s\n" "$0" "$1" 1>&2
|
printf "ERROR %s: %s\n" "$0" "$1" 1>&2
|
||||||
|
@ -59,7 +50,7 @@ read -r projectsite < projectsite || :
|
||||||
|
|
||||||
install_packages()
|
install_packages()
|
||||||
{
|
{
|
||||||
[ $# -lt 2 ] && badcmd "fewer than two arguments"
|
[ $# -lt 2 ] && $err "fewer than two arguments"
|
||||||
eval `setcfg "config/dependencies/$2"`
|
eval `setcfg "config/dependencies/$2"`
|
||||||
|
|
||||||
$pkg_add $pkglist || $err "Cannot install packages"
|
$pkg_add $pkglist || $err "Cannot install packages"
|
||||||
|
|
|
@ -33,8 +33,9 @@ main()
|
||||||
{
|
{
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
if [ "$1" = "serprog" ]; then
|
if [ "$1" = "serprog" ]; then
|
||||||
[ $# -lt 2 ] && badcmd "serprog type not set"
|
[ $# -lt 2 ] && $err "serprog type not set"
|
||||||
[ "$2" != "rp2040" ] && [ "$2" != "stm32" ] && badcmd
|
[ "$2" != "rp2040" ] && [ "$2" != "stm32" ] && \
|
||||||
|
$err "invalid serprog type"
|
||||||
eval "x_ ./update trees -f \"\${${2}src##*/}\""
|
eval "x_ ./update trees -f \"\${${2}src##*/}\""
|
||||||
ser="$2" && shift 2 && continue
|
ser="$2" && shift 2 && continue
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -28,7 +28,7 @@ main()
|
||||||
-s) mode="savedefconfig" ;;
|
-s) mode="savedefconfig" ;;
|
||||||
-l) mode="olddefconfig" ;;
|
-l) mode="olddefconfig" ;;
|
||||||
-n) mode="nconfig" ;;
|
-n) mode="nconfig" ;;
|
||||||
*) badcmd "invalid option '-$option'" ;;
|
*) $err "invalid option '-$option'" ;;
|
||||||
esac
|
esac
|
||||||
shift; project="${OPTARG#src/}"; shift
|
shift; project="${OPTARG#src/}"; shift
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue