testing: Use blockdev instead of partprobe to load partitions

This avoids a dependency on parted as blockdev is in util-linux on
Debian/Ubuntu, which is installed by default.  And it might work more
reliably.
This commit is contained in:
Tobias Brunner
2025-04-10 08:31:09 +02:00
parent 353d5c130b
commit d7305a556f
5 changed files with 10 additions and 10 deletions
+2 -2
View File
@@ -27,7 +27,7 @@ HOSTSDIR=$DIR/../hosts
[ -f $HOSTDIR ] || die "Hosts directory $HOSTSDIR not found"
running_any $STRONGSWANHOSTS && die "Please stop test environment before running $0"
check_commands partprobe qemu-img qemu-nbd
check_commands blockdev qemu-img qemu-nbd
load_qemu_nbd
@@ -43,7 +43,7 @@ do
log_action "Creating guest image for $host"
execute "qemu-img create -b $ROOTIMG -f $IMGEXT -F $IMGEXT $IMGDIR/$host.$IMGEXT" 0
execute "qemu-nbd -c $NBDEV $IMGDIR/$host.$IMGEXT" 0
partprobe $NBDEV
blockdev --rereadpt $NBDEV
execute "mount $NBDPARTITION $LOOPDIR" 0
execute "cp -rf $HOSTSDIR/default/* $LOOPDIR" 0
execute "cp -rf $HOSTSDIR/${host}/etc $LOOPDIR" 0