mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-19 19:23:24 +02:00
lib.sh: tidy up the error handling
Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
+4
-8
@@ -128,12 +128,9 @@ if [ -z "${TMPDIR+x}" ]; then
|
|||||||
export TMPDIR="/tmp"
|
export TMPDIR="/tmp"
|
||||||
export TMPDIR="$(mktemp -d -t xbmk_XXXXXXXX)"
|
export TMPDIR="$(mktemp -d -t xbmk_XXXXXXXX)"
|
||||||
touch lock || $err "cannot create 'lock' file"
|
touch lock || $err "cannot create 'lock' file"
|
||||||
rm -Rf "$XBMK_CACHE/xbmkpath" "$XBMK_CACHE/gnupath" || \
|
x_ rm -Rf "$XBMK_CACHE/xbmkpath" "$XBMK_CACHE/gnupath"
|
||||||
$err "cannot remove xbmkpath"
|
x_ mkdir -p "$XBMK_CACHE/gnupath" "$XBMK_CACHE/xbmkpath"
|
||||||
mkdir -p "$XBMK_CACHE/gnupath" "$XBMK_CACHE/xbmkpath" || \
|
export PATH="$XBMK_CACHE/xbmkpath:$XBMK_CACHE/gnupath:$PATH"
|
||||||
$err "cannot create gnupath"
|
|
||||||
export PATH="$XBMK_CACHE/xbmkpath:$XBMK_CACHE/gnupath:$PATH" || \
|
|
||||||
$err "Can't create gnupath/xbmkpath"
|
|
||||||
(
|
(
|
||||||
# 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.
|
||||||
@@ -241,8 +238,7 @@ download()
|
|||||||
dl_fail="n" # 1 url, 2 url backup, 3 destination, 4 checksum
|
dl_fail="n" # 1 url, 2 url backup, 3 destination, 4 checksum
|
||||||
vendor_checksum "$4" "$cached" 2>/dev/null && dl_fail="y"
|
vendor_checksum "$4" "$cached" 2>/dev/null && dl_fail="y"
|
||||||
[ "$dl_fail" = "n" ] && e "$3" f && return 0
|
[ "$dl_fail" = "n" ] && e "$3" f && return 0
|
||||||
mkdir -p "${3%/*}" "$XBMK_CACHE/file" || \
|
x_ mkdir -p "${3%/*}" "$XBMK_CACHE/file"
|
||||||
$err "!mkdir '$3' '$XBMK_CACHE/file'"
|
|
||||||
for url in "$1" "$2"; do
|
for url in "$1" "$2"; do
|
||||||
[ "$dl_fail" = "n" ] && break
|
[ "$dl_fail" = "n" ] && break
|
||||||
[ -z "$url" ] && continue
|
[ -z "$url" ] && continue
|
||||||
|
|||||||
Reference in New Issue
Block a user