From da2fe90630d3cab4f26cd71f0a2d56df62e3c89b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Uwe=20K=C3=B6cher?= Date: Sun, 8 Nov 2015 23:22:19 +0100 Subject: [PATCH] candi: bugfix for unpack --- candi.sh | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/candi.sh b/candi.sh index c965391..20ac6c1 100755 --- 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 -- 2.39.5