In libguestfs ≥ 1.19.32 you can now use the virt-sysprep to add “firstboot” scripts to Linux guests. These scripts run exactly once the next time the guest boots, so you can use them to customize the guest in an infinite number of ways: Installing software, changing logos and desktop backgrounds, adding user accounts, etc.
To use this, simply use the --firstboot
option on the command line as many times as required:
$ virt-sysprep -a guest.img \ --firstboot ./yum-update.sh \ --firstboot ./set-desktop.sh
Now that’s an interesting feature! Unfortunately it will take a while to RHEL 6.5 to be released with 1.20
I guess this is more likely a RHEL 7 feature.
Nevertheless, you can already do this using guestfish. virt-sysprep makes it simpler, but you can follow the same steps by hand.
I still hope 1.20 get in RHEL 6.5 , this way is simpler to write and read. I’ve got some projects which could used it.
But anyway, that’s script you posted is a good solution, for now at least.
nice! Unique ID regeneration needs per-VM regeneration and this is the solution 🙂