changeset 2:b5a2cd3210fa draft

Uploaded
author davidvanzessen
date Tue, 19 Nov 2013 06:00:20 -0500
parents 83cb18fb0a87
children 75fe272c4b78
files imgtconvert.sh
diffstat 1 files changed, 52 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/imgtconvert.sh	Wed Nov 13 09:46:37 2013 -0500
+++ b/imgtconvert.sh	Tue Nov 19 06:00:20 2013 -0500
@@ -1,6 +1,57 @@
 #!/bin/bash
 dir="$(cd "$(dirname "$0")" && pwd)"
 mkdir $PWD/files
-aunpack -q $1 -X $PWD/files/
+
+
+#!/bin/bash
+f=$(file $1)
+zip7Type="7-zip archive"
+tarType="tar archive"
+bzip2Type="bzip2 compressed"
+gzipType="gzip compressed"
+zipType="Zip archive"
+rarType="RAR archive"
+
+if [[ "$f" == *"$zip7Type"* ]]; then
+	echo "7-zip"
+	echo "Trying: 7za e $1 -o$PWD/files/"
+	7za e $1 -o$PWD/files/
+fi
+
+if [[ "$f" == *"$tarType"* ]]
+then
+	echo "tar archive"
+	echo "Trying: tar xvf $1 -C $PWD/files/"
+	tar xvf $1 -C $PWD/files/
+fi
+
+if [[ "$f" == *"$bzip2Type"* ]]
+then
+	echo "bzip2 compressed data"
+	echo "Trying: tar jxf $1 -C $PWD/files/"
+	tar jxf $1 -C $PWD/files/
+fi
+
+if [[ "$f" == *"$gzipType"* ]]
+then
+	echo "gzip compressed data"
+	echo "Trying: tar xvzf $1 -C $PWD/files/"
+	tar xvzf $1 -C $PWD/files/
+fi
+
+if [[ "$f" == *"$zipType"* ]]
+then
+	echo "Zip archive"
+	echo "Trying: unzip $1 -d $PWD/files/"
+	unzip $1 -d $PWD/files/
+fi
+
+if [[ "$f" == *"$rarType"* ]]
+then
+	echo "RAR archive"
+	echo "Trying: unrar e $1 $PWD/files/"
+	unrar e $1 $PWD/files/
+fi
+
 python $dir/imgtconvert.py --input $PWD/files --output $2