diff --git a/create-iso-jenkins.sh b/create-iso-jenkins.sh index 5def50bf22d1ce60535591e0f9565567a940f8f0..1809167dca0570b31c729457f101eb8219ff1166 100755 --- a/create-iso-jenkins.sh +++ b/create-iso-jenkins.sh @@ -28,6 +28,7 @@ sudo ./create-iso.sh --all "iso/$ISO" \ --dist "$DIST" \ --host "$MIRROR" \ --mirror "$REPO" \ + --clean \ --output "$OUTPUT" <<< y RESULT=$? diff --git a/create-iso.sh b/create-iso.sh index abb119ae1aa253d7c42bf03376b18e4a71890dde..384817f19e2e0710121babb02a2742f4eba06c25 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 diff --git a/scripts/common-functions.sh b/scripts/common-functions.sh index 3592298f456b3635805bbb2997b6abc4c75adcb2..380ffe370158204648f79ebc7f99bebae550ebad 100755 --- a/scripts/common-functions.sh +++ b/scripts/common-functions.sh @@ -69,7 +69,7 @@ closeChroot() umount -l "$CHROOTDIR"/sys && removeMountList "$CHROOTDIR"/sys fi if grep -qs "$CHROOTDIR/proc" /proc/mounts; then - umount -l "$CHROOTDIR"/proc && removeMountLit "$CHROOTDIR"/proc + umount -l "$CHROOTDIR"/proc && removeMountList "$CHROOTDIR"/proc fi if grep -qs "$CHROOTDIR/dev" /proc/mounts; then umount -l "$CHROOTDIR"/dev && removeMountList "$CHROOTDIR"/dev