mirror of
https://github.com/erenfro/gen2stage4.git
synced 2024-11-13 02:38:57 -05:00
24 lines
688 B
Bash
Executable file
24 lines
688 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
STAGE_FILE=${1}
|
|
|
|
EXT="${STAGE_FILE##*.}"
|
|
|
|
TARFILE="${STAGE_FILE%%.$EXT}"
|
|
TAREXT="${TARFILE##*.}"
|
|
|
|
if [[ $TAREXT != "tar" ]]; then
|
|
echo "The stage file you are trying to unpack (\`$STAGE_FILE\`) does not appear to be an archived TAR file"
|
|
else
|
|
echo "Extracting \`${STAGE_FILE}\` inplace."
|
|
fi
|
|
|
|
if [ "$EXT" == "xz" ]; then
|
|
tar -I 'xz -T0' -xvf "${STAGE_FILE}" --xattrs-include='*.*' --numeric-owner
|
|
elif [ "$EXT" == "bz2" ]; then
|
|
tar -I pbzip2 -xvf "${STAGE_FILE}" --xattrs-include='*.*' --numeric-owner
|
|
elif [ "$EXT" == "gz" ]; then
|
|
tar -I unpigz -xvf "${STAGE_FILE}" --xattrs-include='*.*' --numeric-owner
|
|
else
|
|
echo "Not sure how to unpack \`${STAGE_FILE}\`"
|
|
fi
|