| ... | ... |
@@ -131,16 +131,17 @@ fi |
| 131 | 131 |
if [ $ROOTSIZE -gt 2000 ]; then |
| 132 | 132 |
# Resize the container |
| 133 | 133 |
qemu-img resize $IMG_FILE +$((ROOTSIZE - 2000))M |
| 134 |
+fi |
|
| 134 | 135 |
|
| 135 |
- # Connect to nbd and wait till it is ready |
|
| 136 |
- qemu-nbd -c $NBD $IMG_FILE |
|
| 137 |
- if ! timeout 60 sh -c "while ! [ -e /sys/block/$NBD_DEV/pid ]; do sleep 1; done"; then |
|
| 138 |
- echo "Couldn't connect $NBD" |
|
| 139 |
- exit 1 |
|
| 140 |
- fi |
|
| 136 |
+# Connect to nbd and wait till it is ready |
|
| 137 |
+qemu-nbd -c $NBD $IMG_FILE |
|
| 138 |
+if ! timeout 60 sh -c "while ! [ -e /sys/block/$NBD_DEV/pid ]; do sleep 1; done"; then |
|
| 139 |
+echo "Couldn't connect $NBD" |
|
| 140 |
+ exit 1 |
|
| 141 |
+fi |
|
| 141 | 142 |
|
| 142 |
- # Resize partition 1 to full size of the disk image |
|
| 143 |
- echo "d |
|
| 143 |
+# Resize partition 1 to full size of the disk image |
|
| 144 |
+echo "d |
|
| 144 | 145 |
n |
| 145 | 146 |
p |
| 146 | 147 |
1 |
| ... | ... |
@@ -152,8 +153,7 @@ a |
| 152 | 152 |
1 |
| 153 | 153 |
w |
| 154 | 154 |
" | fdisk $NBD |
| 155 |
- fsck -t ext4 -f ${NBD}p1
|
|
| 156 |
- resize2fs ${NBD}p1
|
|
| 155 |
+fsck -t ext4 -f ${NBD}p1
|
|
| 156 |
+resize2fs ${NBD}p1
|
|
| 157 | 157 |
|
| 158 |
- qemu-nbd -d $NBD |
|
| 159 |
-fi |
|
| 158 |
+qemu-nbd -d $NBD |