diff options
author | Rob Landley <rob@landley.net> | 2020-06-08 11:49:44 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2020-06-08 11:49:44 -0500 |
commit | 29e73bf0a06d08a8363c932f0479fb7e56fc979f (patch) | |
tree | b0f298f87ce6d34604852ba99ea1c524ba7d92a2 /scripts/root/plumbing | |
parent | ba1a79fa0e7138cd9af4195aa5ebc79ed8ab307c (diff) | |
download | toybox-29e73bf0a06d08a8363c932f0479fb7e56fc979f.tar.gz |
Tweak comments and error handling
Diffstat (limited to 'scripts/root/plumbing')
-rwxr-xr-x | scripts/root/plumbing | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/root/plumbing b/scripts/root/plumbing index 0bb735ee..ff302803 100755 --- a/scripts/root/plumbing +++ b/scripts/root/plumbing @@ -8,15 +8,15 @@ mkdir -p "${DOWNLOAD:=$PWD/root_download}" || exit 1 ### Functions to download, extract, and clean up after source packages. # Usage: download HASH URL -# Grabs source from URL confirming SHA1 hash (Basically == "wget $2") -# You can stick extracted source in $DOWNLOAD and build will use that instead +# Grabs source from URL confirming SHA1 hash (Basically "wget $2") +# If extracted source is in $DOWNLOAD (no version) build will use that instead download() { FILE="$(basename "$2")" [ -d "$DOWNLOAD/${FILE/-*/}" ] && echo "$FILE" local && return 0 X=0; while true; do [ "$(sha1sum < "$DOWNLOAD/$FILE" 2>/dev/null)" == "$1 -" ] && echo "$FILE" confirmed && break - rm -f $DOWNLOAD/${FILE/-[0-9]*/}-[0-9]* || break + rm -f $DOWNLOAD/${FILE/-[0-9]*/}-[0-9]* || exit 1 [ $X -eq 0 ] && X=1 || exit 1 wget "$2" -O "$DOWNLOAD/$FILE" done |