Teach setupfor to cope if tarball doesn't extract to package name.

This commit is contained in:
Rob Landley 2024-06-17 15:58:16 -05:00
parent 73871f7653
commit 0a7def52d7

View File

@ -31,7 +31,9 @@ setupfor() {
if [ -d "$DOWNLOAD/$PACKAGE" ]; then
cp -la "$DOWNLOAD/$PACKAGE/." "$PACKAGE" && cd "$PACKAGE" || exit 1
else
tar xvaf "$DOWNLOAD/$PACKAGE"-*.t* && cd "$PACKAGE"-* || exit 1
local DIR=$(mktemp -dp.)
tar xvafC "$DOWNLOAD/$PACKAGE"-*.t* "$DIR" &&
mv "$DIR"/* "$PACKAGE" && rmdir "$DIR" && cd "$PACKAGE" || exit 1
fi
}