tossing zip's output, and tar's for the heck of it (although it had none).
[feisty_meow.git] / scripts / archival / unpack.sh
index 38629ec8a3dee9b59e4e715c302ba26a4c4fec0f..5641df960b108f74f4addfdb1ab77cf0c365e183 100644 (file)
@@ -37,7 +37,7 @@ if [ ! -d "$unpack_dir" ]; then
 fi
 
 # save where we started out.
-ORIGINATING_FOLDER="$( \cd "$(\dirname "$0")" && \pwd )"
+ORIGINATING_FOLDER="$( \pwd )"
 
 pushd "$unpack_dir" &>/dev/null
 
@@ -51,19 +51,21 @@ if [ ! -f "$unpack_file" ]; then
   fi
 fi
 
-if [[ $unpack_file =~ .*\.tar\.gz \
-    || $unpack_file =~ .*\.tar\.bz2 \
-    || $unpack_file =~ .*\.tgz ]]; then
-  tar -xf $unpack_file
-elif [[ $unpack_file =~ .*\.zip ]]; then
-  unzip $unpack_file
+if [[ $unpack_file =~ .*\.tar$ \
+    || $unpack_file =~ .*\.tar\.gz$ \
+    || $unpack_file =~ .*\.tar\.bz2$ \
+    || $unpack_file =~ .*\.tgz$ ]]; then
+  tar -xf $unpack_file &>/dev/null
+elif [[ $unpack_file =~ .*\.zip$ ]]; then
+  unzip $unpack_file &>/dev/null
 fi
 save_err=$?
 
+popd &>/dev/null
+
 if [ $save_err -ne 0 ]; then
   echo "There was a failure reported while unpacking: $unpack_file"
   echo "into the directory: $unpack_dir"
-  popd &>/dev/null
   exit 1
 else
   echo "Unpacked file $(basename $unpack_file) into folder: $unpack_dir"