Cleanup after failed volatile.img preparation
This commit is contained in:
parent
cba8c6430c
commit
063e2617d6
@ -20,6 +20,15 @@ if [ -e "$FILENAME" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
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 ]
|
TOTAL_SIZE=$[ $ROOT_SIZE + $SWAP_SIZE + 512 ]
|
||||||
truncate -s ${TOTAL_SIZE}M "$FILENAME"
|
truncate -s ${TOTAL_SIZE}M "$FILENAME"
|
||||||
sfdisk --no-reread -u M "$FILENAME" > /dev/null 2> /dev/null <<EOF
|
sfdisk --no-reread -u M "$FILENAME" > /dev/null 2> /dev/null <<EOF
|
||||||
|
Loading…
Reference in New Issue
Block a user