mirror of
https://github.com/parkervcp/eggs.git
synced 2025-02-21 15:43:30 +08:00
add file unpacker
This is to unpack files.
This commit is contained in:
parent
533ce1f343
commit
f5c7014231
15
scripts/file_unpacker.sh
Normal file
15
scripts/file_unpacker.sh
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
## 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
|
Loading…
Reference in New Issue
Block a user