lib.sh: minor cleanup

Signed-off-by: Leah Rowe <leah@libreboot.org>
25.04_branch
Leah Rowe 2025-04-12 17:35:30 +01:00
parent 8999d30b96
commit 3b2718bd9d
1 changed files with 5 additions and 8 deletions

View File

@ -135,8 +135,7 @@ if [ -z "${TMPDIR+x}" ]; then
# set up python v3.x in PATH, in case it's not set up correctly. # set up python v3.x in PATH, in case it's not set up correctly.
# see code above that detected the correct python3 command. # see code above that detected the correct python3 command.
cd "$XBMK_CACHE/xbmkpath" || $err "can't cd $XBMK_CACHE/xbmkpath" cd "$XBMK_CACHE/xbmkpath" || $err "can't cd $XBMK_CACHE/xbmkpath"
ln -s "`command -v "$python"`" python || \ x_ ln -s "`command -v "$python"`" python
$err "Can't set up python symlink in $XBMK_CACHE/xbmkpath"
) || $err "Can't set up python symlink in $XBMK_CACHE/xbmkpath" ) || $err "Can't set up python symlink in $XBMK_CACHE/xbmkpath"
xbmk_parent="y" xbmk_parent="y"
fi fi
@ -151,8 +150,7 @@ expr "X$XBMK_THREADS" : "X-\{0,1\}[0123456789][0123456789]*$" \
1>/dev/null 2>/dev/null || export XBMK_THREADS=1 # user gave a non-integer 1>/dev/null 2>/dev/null || export XBMK_THREADS=1 # user gave a non-integer
x_() { x_() {
[ $# -lt 1 ] || "$@" || \ [ $# -lt 1 ] || "$@" || $err "Unhandled error for: $(echo "$@")"; :
$err "Unhandled non-zero exit: $(echo "$@")"; :
} }
[ -e ".git" ] || [ -f ".version" ] || printf "unknown\n" > .version || \ [ -e ".git" ] || [ -f ".version" ] || printf "unknown\n" > .version || \
@ -227,7 +225,7 @@ singletree()
{ {
for targetfile in "config/${1}/"*/target.cfg; do for targetfile in "config/${1}/"*/target.cfg; do
[ -e "$targetfile" ] && [ -f "$targetfile" ] && return 1; : [ -e "$targetfile" ] && [ -f "$targetfile" ] && return 1; :
done; return 0 done; :
} }
# can grab from the internet, or copy locally. # can grab from the internet, or copy locally.
@ -263,7 +261,7 @@ download()
vendor_checksum "$4" "$cached" || dl_fail="n" vendor_checksum "$4" "$cached" || dl_fail="n"
done done
[ "$dl_fail" = "y" ] && $err "$1 $2 $3 $4: not downloaded" [ "$dl_fail" = "y" ] && $err "$1 $2 $3 $4: not downloaded"
[ "$cached" = "$3" ] || cp "$cached" "$3" || $err "!d cp $cached $3"; : [ "$cached" = "$3" ] || x_ cp "$cached" "$3"; :
} }
vendor_checksum() vendor_checksum()
@ -290,8 +288,7 @@ cbfs()
fi fi
fi fi
"$cbfstool" "$fRom" $ccmd -f "$fAdd" -n "$fName" $lzma || \ x_ "$cbfstool" "$fRom" $ccmd -f "$fAdd" -n "$fName" $lzma
$err "CBFS fail: $fRom $ccmd -f '$fAdd' -n '$fName' $lzma"; :
} }
mk() mk()