]> https://gitweb.dealii.org/ - candi.git/commitdiff
candi: bugfix for unpack
authorUwe Köcher <koecher@hsu-hamburg.de>
Sun, 8 Nov 2015 22:22:19 +0000 (23:22 +0100)
committerUwe Köcher <koecher@hsu-hamburg.de>
Sun, 8 Nov 2015 22:22:19 +0000 (23:22 +0100)
candi.sh

index c96539107fcb6999566668a1472468d9cb4910b9..20ac6c1e19d0efa9234a2fd446b8586cb27de0a3 100755 (executable)
--- a/candi.sh
+++ b/candi.sh
@@ -334,6 +334,7 @@ package_fetch () {
 package_unpack() {
     # First make sure we're in the right directory before unpacking
     cd ${UNPACK_PATH}
+    echo "${UNPACK_PATH}"
     FILE_TO_UNPACK=${DOWNLOAD_PATH}/${NAME}${PACKING}
     
     # Only need to unpack archives
@@ -344,6 +345,25 @@ package_unpack() {
             cecho ${BAD} "${FILE_TO_UNPACK} does not exist. Please download first."
             exit 1
         fi
+        
+        # remove old unpack (this might be corrupted)
+        if [ -d "${EXTRACTSTO}" ]; then
+            rm -rf ${EXTRACTSTO}
+            quit_if_fail "Removing of ${EXTRACTSTO} failed."
+        fi
+        
+        # Unpack the archive only if it isn't already
+        
+        # Unpack the archive in accordance with its packing
+        if [ ${PACKING} = ".tar.bz2" ] || [ ${PACKING} = ".tbz2" ]; then
+            tar xjf ${FILE_TO_UNPACK}
+        elif [ ${PACKING} = ".tar.gz" ] || [ ${PACKING} = ".tgz" ]; then
+            tar xzf ${FILE_TO_UNPACK}
+        elif [ ${PACKING} = ".tar.xz" ]; then
+            tar xJf ${FILE_TO_UNPACK}
+        elif [ ${PACKING} = ".zip" ]; then
+            unzip ${FILE_TO_UNPACK}
+        fi
     fi
     
     # Quit with a useful message if something goes wrong
@@ -635,6 +655,13 @@ else
     fi
 fi
 
+# Source default PLATFORM variables, if present
+PLATFORM_DEFAULT=${PROJECT}/platforms/default.packages
+if [ -e ${PLATFORM_DEFAULT} ]; then
+    source ${PLATFORM_DEFAULT}
+fi
+
+
 # Source PLATFORM variables if set up correctly
 if [ -z ${PLATFORM} ]; then
     cecho ${BAD} "Please contact the authors, if you have not changed candi!"
@@ -786,8 +813,6 @@ echo "--------------------------------------------------------------------------
 cecho ${GOOD} "Once ready, hit enter to continue!"
 read
 
-################################################################################
-cls
 ################################################################################
 # Output configuration details
 cls

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.