mirror of
https://github.com/parkervcp/eggs.git
synced 2024-11-12 04:27:24 +08:00
f5c7014231
This is to unpack files.
15 lines
522 B
Bash
15 lines
522 B
Bash
## only needs to have the file with a file passed into it to get the filetype.
|
|
## only supports tar.gz/xz and zip currently for unpacking.
|
|
## The value for ${DOWNLOAD_LINK##*/} is
|
|
|
|
FILETYPE=$(file -F ',' ${DOWNLOAD_LINK##*/} | cut -d',' -f2 | cut -d' ' -f2)
|
|
if [ "$FILETYPE" == "gzip" ]; then
|
|
tar xzvf ${DOWNLOAD_LINK##*/}
|
|
elif [ "$FILETYPE" == "Zip" ]; then
|
|
unzip ${DOWNLOAD_LINK##*/}
|
|
elif [ "$FILETYPE" == "XZ" ]; then
|
|
tar xvf ${DOWNLOAD_LINK##*/}
|
|
else
|
|
echo -e "unknown filetype. Exeting"
|
|
exit 2
|
|
fi |