From d23bb80d599cfa48ed49250c3d568c1dc70fc8dc Mon Sep 17 00:00:00 2001 From: Diego Giovane Pasqualin <dpasqualin@c3sl.ufpr.br> Date: Mon, 21 Oct 2013 17:12:44 -0200 Subject: [PATCH] create-iso.sh: Allow user to clean files after iso generation This prevents trash on /dev/shm Signed-off-by: Diego Giovane Pasqualin <dpasqualin@c3sl.ufpr.br> --- create-iso.sh | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/create-iso.sh b/create-iso.sh index abb119a..384817f 100755 --- a/create-iso.sh +++ b/create-iso.sh @@ -142,8 +142,9 @@ replaceIso() if [ "$ack" == "y" ]; then log "Cleaning temporary directory ..." - rm -rf "$TMP"/* "$CHROOTDIR" "$CDDIR" "$SQUASHIMAGE" || return 6 - #$0 --clean --dist $1 || exit 6 + if ! cleanFiles; then + return 6 + fi else log "Extraction canceled!" return 1 @@ -153,6 +154,13 @@ replaceIso() return 0 } +# Remove files used on the generation process and umount files +cleanFiles() +{ + checkMountedFS + rm -rf "$TMP"/* "$CHROOTDIR" "$CDDIR" "$SQUASHIMAGE" || return 6 +} + log() { if "$LOGINFO" && [ "$1" ]; then @@ -253,7 +261,6 @@ checkOutput "$OUTPUT" || exit 8 #------------------------------------------------------------------------------ # Init routines - if $iso; then if ! regenerateManifest | log; then log "Error to regenarate manifest file" @@ -272,10 +279,6 @@ elif $edit; then log "Error to edit Squash image" exit 2 fi -elif $clean; then - log "Cleaning temporary directory ..." - - rm -rf "$TMP"/* "$CHROOTDIR" "$CDDIR" "$SQUASHIMAGE" || exit 6 elif $all; then replaceIso $distName || exit 6 @@ -300,7 +303,9 @@ elif $all; then exit 5 fi fi - -#/root/teste_ram/rsync.sh +if $clean; then + log "Cleaning temporary directory ..." + cleanFiles || exit $? +fi exit 0 -- GitLab