From 4b44b023e9e6fddef129adcbacc7ef9cf1b40d48 Mon Sep 17 00:00:00 2001 From: George Danchev Date: Sun, 3 Jul 2011 14:25:08 +0000 Subject: [PATCH] complete the cleanup facility --- releng/releng_isojigdo | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/releng/releng_isojigdo b/releng/releng_isojigdo index 9a2e3a91..fa1c00b7 100755 --- a/releng/releng_isojigdo +++ b/releng/releng_isojigdo @@ -9,7 +9,7 @@ SELF=$(basename "$0") CONFFILE=$HOME/.libburnia-releng/${SELF}.conf GEN_DATA_DIR=releng_generated_data/${SELF} TMP_DATA_DIR=releng_generated_data -IMG_EXTRACT_DIR=${TMP_DATA_DIR}/${SELF}_extracted_tree +IMG_EXTRACT_DIR=${GEN_DATA_DIR}/${SELF}_extracted_tree # to be set by the config file RELENG_XORRISO="" @@ -38,13 +38,20 @@ Usage: HLP } +cleanup() { + # safety net, just in case -> we want to be in the starting + # directory before removing whatever self-generated stuff + cd "${START_DIR_DONT_CHANGE}" || exit 15 + chmod +w -R ${GEN_DATA_DIR} + rm -rf ${GEN_DATA_DIR} + printf "${SELF}: Removed %s\n" ${GEN_DATA_DIR} +} + ##################################################################### # cleanup if [ "${1}" == "-cleanup" ]; then - cd "${START_DIR_DONT_CHANGE}" || exit 2 if [ -d "${GEN_DATA_DIR}" ]; then - rm -rf ${GEN_DATA_DIR} - printf "${SELF}: removed %s\n" ${GEN_DATA_DIR} + cleanup else printf "${SELF}: ${GEN_DATA_DIR} does not exist.\n" fi @@ -238,11 +245,7 @@ esac # sort out the cruft if [ ${KEEP} -eq 0 ]; then - # safety net, just in case -> we want to be in the starting - # directory before removing whatever self-generated stuff - cd "${START_DIR_DONT_CHANGE}" || exit 15 - rm -rf ${GEN_DATA_DIR} - printf "${SELF}: Removed %s\n" ${GEN_DATA_DIR} + cleanup else printf "${SELF}: Leaving %s\n" ${GEN_DATA_DIR} fi