[Swan-dev] [ot] getting systemd to set the KVM test domain's hostname

Andrew Cagney andrew.cagney at gmail.com
Thu Aug 6 03:14:03 UTC 2020


On Wed, 5 Aug 2020 at 20:55, Paul Wouters <paul at nohats.ca> wrote:
>
> On Wed, 5 Aug 2020, Andrew Cagney wrote:
>
> >> Using a oneshot service we install via anaconda ?
> >>
> >> https://gist.github.com/tuxfight3r/937be13b08395101d7201883d7410a0d
> >
> > it is a starting point, however the disk image (or clones) are:
> > - created using kick-start
> > - booted as base to install packages
> > - booted as build to build libvirt
> > - booted as east, ..., to test
> > so a simple oneshot would have happened long ago
>
> It is one shot per boot. The system just waits for it to complete, and
> once it exits it is deemed completed and fine and won't start again
> until the system has rebooted.

oops, my bad

> > the .network files - all of which are installed - now look like this:
> > https://github.com/libreswan/libreswan/commit/c89711225f3a1c4384d6df8d17b2508997e26a0e
> > so the network is figured out using systemd
>
> Oh that's good. espcially if that removes the "service network restart"
> completely.

it should yes

> eg:
>
> On the base system, ensure /etc/hostname is an empty file. then install
> this:
>
> # /lib/systemd/system/hostnaming.service
> [Unit]
> Description=Figure out who we are
> ConditionFileNotEmpty=|!/etc/hostname

ah, that is a critical bit of needed magic

> After=systemd-networkd.service
> Before=network.target
>
> [Service]
> Type=oneshot
> ExecStart=/testing/guestbin/hostnamer

if the raw networks are configured, it could use ip addresses

> [Install]
> WantedBy=multi-user.target
>
>
>
> Paul


More information about the Swan-dev mailing list