In the TODO file there's a discussion of perhaps writing a new
'virt-customize' tool. I think it's probably better (or at any rate,
easier) to just add this functionality into virt-sysprep. That is
what this small series of patches aims to achieve.
Note these are not very well tested at the moment.
The first patch adds a generic and useful '--firstboot' flag. The
intended use is to add programs/scripts that run at first boot, for
example:
virt-sysprep -d some_guest \
--firstboot ./yum-update.sh \
--firstboot ./add-users.sh
This is implemented by installing a systemd or sysvinit service into
the guest which runs the scripts when the guest boots, deleting them
after they have run. [Dan: Is the systemd unit correct?]
Patches 2/4 and 3/4 implement another customization: setting the
login screen background image.
When I actually started investigating how to do this, I realized it is
fearsomely complicated because basically every guest type has its own
method to do this, and they even change frequently between versions
(eg. gconf -> dconf, GNOME vs KDE etc). Since the --firstboot
parameter effectively gives this capability to system administrators
(albeit they need to work out how to do it themselves), I think it may
be a good idea to invest the time making sure --firstboot is
bullet-proof, and *not* implement specific customizations like this.
What do people think?
Patch 4/4 updates the man page to reflect the new capabilities of
virt-sysprep.
Comments welcome.
Rich.