`xen-create-image` doesn't create image for bookworm with a working
network, we need to fix the interface name.
For reference, there's a bug report upstream:
"UnPredictableNetworkInterfaceNames 'fun' with Bookworm domU: eth0 -> enX0"
https://github.com/xen-tools/xen-tools/issues/65
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
END
}
+sub fix_networking () {
+ return if debian_guest_suite($gho) !~ m/bookworm/;
+
+ # `xen-create-image` doesn't setup network in a way that work with bookworm.
+ # The guest boots with "enX0" interface name, but it only try to setup "eth0".
+ # https://github.com/xen-tools/xen-tools/issues/65
+ target_editfile_root($ho, $mountpoint."/etc/network/interfaces", sub {
+ while (<::EI>) {
+ s/\beth0\b/enX0/g;
+ print ::EO or die $!;
+ }
+ });
+}
+
sub unmount () {
guest_umount_lv($ho, $gho);
}
console();
randomseed();
filesystems();
+fix_networking();
otherfixupcfg();
writecfg();
unmount();