Skip to content

Commit 4ebd260

Browse files
committed
more robust image setup
1 parent 125cd3a commit 4ebd260

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

image/mk_europe_edition.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ sizelimit=$(( 512*sizelimit ))
3232
# Append one GB and truncate to size
3333
#truncate -s 2600M $IMGNAME
3434
qemu-img resize $IMGNAME 2500M
35-
losetup -f
36-
losetup /dev/loop0 $IMGNAME
37-
partprobe /dev/loop0
38-
e2fsck -f /dev/loop0p2
39-
fdisk /dev/loop0 <<EOF
35+
lo=$(losetup -f)
36+
losetup $lo $IMGNAME
37+
partprobe $lo
38+
e2fsck -f ${lo}p2
39+
fdisk $lo <<EOF
4040
p
4141
d
4242
2
@@ -48,9 +48,9 @@ $sector
4848
p
4949
w
5050
EOF
51-
partprobe /dev/loop0
52-
resize2fs -p /dev/loop0p2
53-
losetup -d /dev/loop0
51+
partprobe $lo
52+
resize2fs -p ${lo}p2
53+
losetup -d $lo
5454

5555

5656

image/mk_europe_edition_device_setup.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,12 @@ rm -r /proc/*
2929
rm -r /root/fake
3030

3131
# For some reason, qemu build fails unless we use a single compilation thread. Compilation takes quite long...
32+
# It also rarely crashes with one process, so the important commands are executed multiple times. Once succeeded, execution will be very fast
33+
# so the performance overhead should be marginal.
3234
export GOMAXPROCS=1
3335
go get -u github.com/kidoman/embd/embd
36+
go get -u github.com/kidoman/embd/embd
37+
go get -u github.com/kidoman/embd/embd
3438
make clean
3539
# Sometimes go build fails for some reason.. we will just try three times and hope for the best
3640
make

0 commit comments

Comments
 (0)