diff --git a/linux/aux-tools/prepare-volatile-img.sh b/linux/aux-tools/prepare-volatile-img.sh index 60fb2ce3..3b293eca 100755 --- a/linux/aux-tools/prepare-volatile-img.sh +++ b/linux/aux-tools/prepare-volatile-img.sh @@ -20,15 +20,6 @@ if [ -e "$FILENAME" ]; then exit 1 fi -# Cleanup lefovers from possible previous run -loopdev=`losetup -a | grep "$FILENAME" | cut -f 1 -d :` -if [ -n "$loopdev" ]; then - dmsetup remove `basename $loopdev`p1 2>/dev/null - dmsetup remove `basename $loopdev`p2 2>/dev/null - losetup -d $loopdev - udevadm settle -fi - TOTAL_SIZE=$[ $ROOT_SIZE + $SWAP_SIZE + 512 ] truncate -s ${TOTAL_SIZE}M "$FILENAME" sfdisk --no-reread -u M "$FILENAME" > /dev/null 2> /dev/null < /dev/null 2> /dev/null < /dev/null +loopdev=`losetup -f --show --partscan "$FILENAME"` +mkswap -f ${loopdev}p1 > /dev/null udevadm settle -kpartx -s -d ${loopdev} losetup -d ${loopdev} || : chown --reference `dirname "$FILENAME"` "$FILENAME"