init.sh: move setvars/err_ to lib.sh

these functions make more sense in lib.sh

i made mk link lib.sh first, so that the
functions on init.sh can still use them.

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2025-05-02 05:54:36 +01:00
parent c073ee9d4f
commit 2ae565ba93
3 changed files with 23 additions and 22 deletions

View File

@@ -16,27 +16,6 @@ xbmkpath="$PATH"
err="err_"
setvars()
{
_setvars=""
if [ $# -lt 2 ]; then
printf "\$err \"setvars: too few args\\n\""
return 0
fi
val="$1"
shift 1
for var in "$@"; do
_setvars="$var=\"$val\"; $_setvars"
done
printf "%s\n" "${_setvars% }"
}
err_()
{
printf "ERROR %s: %s\n" "$0" "$1" 1>&2
exit 1
}
eval "`setvars "" _nogit board reinstall versiondate aur_notice configdir \
datadir version xbmkpwd relname xbmkpwd xbmktmp python pyver`"

View File

@@ -115,3 +115,24 @@ check_defconfig()
[ -f "$x" ] && printf "%s\n" "$x" && return 1
done; :
}
setvars()
{
_setvars=""
if [ $# -lt 2 ]; then
printf "\$err \"setvars: too few args\\n\""
return 0
fi
val="$1"
shift 1
for var in "$@"; do
_setvars="$var=\"$val\"; $_setvars"
done
printf "%s\n" "${_setvars% }"
}
err_()
{
printf "ERROR %s: %s\n" "$0" "$1" 1>&2
exit 1
}

3
mk
View File

@@ -12,8 +12,9 @@ if [ "./${0##*/}" != "${0}" ] || [ ! -f "mk" ] || [ -L "mk" ]; then
exit 1
fi
. "include/init.sh"
. "include/lib.sh"
. "include/init.sh"
. "include/inject.sh"
. "include/mrc.sh"