complete the cleanup facility

This commit is contained in:
George Danchev 2011-07-03 14:25:08 +00:00
parent 0dd950ec19
commit e8882ec805

View File

@ -9,7 +9,7 @@ SELF=$(basename "$0")
CONFFILE=$HOME/.libburnia-releng/${SELF}.conf CONFFILE=$HOME/.libburnia-releng/${SELF}.conf
GEN_DATA_DIR=releng_generated_data/${SELF} GEN_DATA_DIR=releng_generated_data/${SELF}
TMP_DATA_DIR=releng_generated_data 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 # to be set by the config file
RELENG_XORRISO="" RELENG_XORRISO=""
@ -38,13 +38,20 @@ Usage:
HLP 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 # cleanup
if [ "${1}" == "-cleanup" ]; then if [ "${1}" == "-cleanup" ]; then
cd "${START_DIR_DONT_CHANGE}" || exit 2
if [ -d "${GEN_DATA_DIR}" ]; then if [ -d "${GEN_DATA_DIR}" ]; then
rm -rf ${GEN_DATA_DIR} cleanup
printf "${SELF}: removed %s\n" ${GEN_DATA_DIR}
else else
printf "${SELF}: ${GEN_DATA_DIR} does not exist.\n" printf "${SELF}: ${GEN_DATA_DIR} does not exist.\n"
fi fi
@ -238,11 +245,7 @@ esac
# sort out the cruft # sort out the cruft
if [ ${KEEP} -eq 0 ]; then if [ ${KEEP} -eq 0 ]; then
# safety net, just in case -> we want to be in the starting cleanup
# 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}
else else
printf "${SELF}: Leaving %s\n" ${GEN_DATA_DIR} printf "${SELF}: Leaving %s\n" ${GEN_DATA_DIR}
fi fi