diff options
author | Michael Schroeder <mls@suse.de> | 2012-08-09 18:40:40 +0200 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2012-08-09 18:40:40 +0200 |
commit | b33c6879365da199e5e31e1757aa28d283b78ef3 (patch) | |
tree | 284596d6ecd8912712651f513d4ec757af80451c | |
parent | d5e4317f8c9bbf9144b5948d10debb52af07f121 (diff) | |
download | build-b33c6879365da199e5e31e1757aa28d283b78ef3.tar.gz build-b33c6879365da199e5e31e1757aa28d283b78ef3.tar.bz2 build-b33c6879365da199e5e31e1757aa28d283b78ef3.zip |
- rename vmdisk-cleanup to vmdisk-clean (cleanup sounds like it is done after the build). Also remove the swap image and be careful to not remove device nodes
-rwxr-xr-x | build | 23 |
1 files changed, 14 insertions, 9 deletions
@@ -72,7 +72,7 @@ VMDISK_SWAPSIZE=1024 VMDISK_FILESYSTEM=ext3 # settings are for speed and not data safety, we format anyway on next run VMDISK_MOUNT_OPTIONS=__default -VMDISK_ROOT_CLEAN=no +VMDISK_CLEAN= HUGETLBFSPATH= MEMSIZE= RUNNING_IN_VM= @@ -980,10 +980,9 @@ while test -n "$1"; do VMDISK_MOUNT_OPTIONS=$(echo $ARG | sed 's/^\"\(.*\)\"$/\1/g') shift ;; - *-vmdisk-cleanup) - needarg - VMDISK_ROOT_CLEAN="$ARG" - shift + *-vmdisk-clean) + # delete old root/swap to get rid of the old blocks + VMDISK_CLEAN=true ;; *-rpmlist) needarg @@ -1317,10 +1316,16 @@ if test -z "$RUNNING_IN_VM" ; then XENID="${XENID#root_}" xm destroy "build_$XENID" >/dev/null 2>&1 fi - if [ "$VMDISK_ROOT_CLEAN" = "yes" ]; then - #delete VM image so later we can recreate a new one - echo "Deleting $VM_IMAGE" - rm -rf "$VM_IMAGE" + if test -n "$VMDISK_CLEAN" ; then + # delete old root/swap to get rid of the old blocks + if test -f "$VM_IMAGE" ; then + echo "Deleting old $VM_IMAGE" + rm -rf "$VM_IMAGE" + fi + if test -n "$VM_SWAP" -a -f "$VM_SWAP" ; then + echo "Deleting old $VM_SWAP" + rm -rf "$VM_SWAP" + fi fi if test ! -e "$VM_IMAGE"; then echo "Creating $VM_IMAGE (${VMDISK_ROOTSIZE}M)" |