add the records only to the first (`eth0`) interface, since it is
not possible to have multiple `dns-nameservers` and `dns-search`
entries in the `/etc/network/interfaces` file.
Strip leading and trailing hyphens in the resulting munged hostname.
Leading and trailing hyphens are not valid according to RFCs 952 and 1123.
(This problem surfaces immediately when using the default configuration of
OneFlow, since it names new VMs ending with a parenthesis.)
When setting the hostname from $SET_HOSTNAME, replace any characters
not allowed in hostnames (as specified in RFC 952) with a hyphen.
This is enables a VM template to safely use the VM's name as the
hostname (by setting the context variable SET_HOSTNAME=$NAME).
generate.sh is also modified so it copies the files from these
directories by default or use dir.$ENVIRONMENT if specified. For
example, use ENVIRONMENT=ec2 to copy the directories that end in .ec2:
ENVIRONMENT=ec2 ./generate.sh
base
base.ec2
base_deb
base_deb.ec2
I was unable to make systemd scripts for Debian 7 and CentOS 6
so for backwards compatability made the SysV script call
/usr/sbin/one-contextd. This should be revisited in the future.
also updated 00-network and 05-hostname
One-context.service should be linked to systemd-networkd.service,
tying to do this using the Wants flag. Additionally since
one-context.service should now run before systemd-networkd.service
it's superfluous to restart the unit, this was edited out of
00-network. 05-hostname was edited to use the hostnameclt, the
echo style can probably be removed.
One-context should really have been in sbin all along. Updated
one-context.service to run before systemd-networkd but after udev
or kdbus have run. This should eliminate the requirement for a
systemd-networkd restart.