Mercurial > hg > aboriginal
changeset 1515:63d3f491b92f
Make tarball extract failure detection not rely on "kill" command.
Propogating exit status up from a subshell in a pipeline continues to be fiddly.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sat, 24 Mar 2012 20:29:50 -0500 |
parents | 6db20984e195 |
children | f19ce5e2ec02 |
files | sources/download_functions.sh |
diffstat | 1 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/sources/download_functions.sh Sat Mar 24 19:40:48 2012 -0500 +++ b/sources/download_functions.sh Sat Mar 24 20:29:50 2012 -0500 @@ -76,7 +76,8 @@ # If the source tarball doesn't exist, but the extracted directory is there, # assume everything's ok. - SHA1FILE="$SRCTREE/$PACKAGE/sha1-for-source.txt" + SHA1NAME="sha1-for-source.txt" + SHA1FILE="$SRCTREE/$PACKAGE/$SHA1NAME" if [ -z "$FILENAME" ] then if [ ! -e "$SRCTREE/$PACKAGE" ] @@ -121,11 +122,16 @@ rm -rf "$SRCTREE/$PACKAGE" 2>/dev/null mkdir -p "$BUILD/temp-$UNIQUE" "$SRCTREE" || dienow - { tar -xv${DECOMPRESS} -f "$FILENAME" -C "$BUILD/temp-$UNIQUE" || dienow + { tar -xv${DECOMPRESS} -f "$FILENAME" -C "$BUILD/temp-$UNIQUE" && + # Wildcards only expand when they ponit to something that exists, + # and even then they have to be an argument to a command. + TARDIR="$(readlink -f "$BUILD/temp-$UNIQUE"/*)" && + touch "$TARDIR/$SHA1NAME" } | dotprogress + [ -e "$BUILD/temp-$UNIQUE"/*/"$SHA1NAME" ] && mv "$BUILD/temp-$UNIQUE/"* "$SRCTREE/$PACKAGE" && - echo "$SHA1TAR" > "$SHA1FILE" + echo "$SHA1TAR" >> "$SHA1FILE" ) [ $? -ne 0 ] && dienow