core: move handling of hostname from plugins to core
authorBeniamino Galvani <bgalvani@redhat.com>
Mon, 23 Mar 2015 08:15:47 +0000 (09:15 +0100)
committerBeniamino Galvani <bgalvani@redhat.com>
Fri, 12 Jun 2015 13:59:39 +0000 (15:59 +0200)
commit6c3d71c431ef63005f9005e68ff49b21b153ee9f
tree21935ae904571c6d1d2ed441dc9de1b9b01cc8ba
parentfb304bc6b97155d0d0234d116bace00c6d6ee235
core: move handling of hostname from plugins to core

How to write and read the machine hostname is something that has been
handled until now by plugins; this is questionable since the method
using for storing the hostname should depend only on the distro used
and not on which plugins are enabled.

This commit moves all hostname-related functions from plugins to the
core and allows to specify the method used to load and store the
hostname at build time with the

  --with-hostname-persist=default|suse|gentoo

configure option.

'default' method stores the hostname to /etc/hostname and monitors it
to detect runtime changes.

When the selected method is 'suse', the hostname gets read from and
written to /etc/HOSTNAME; the file /etc/sysconfig/network/dhcp is also
read to detect if the hostname is dynamic and thus invalid. Both files
are monitored for changes.

'gentoo' method relies on /etc/conf.d/hostname for storing the
hostname.
configure.ac
src/settings/nm-settings.c