diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2014-04-25 18:02:06 +0100 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2014-04-28 19:45:52 +0200 |
commit | eeb4680557c5f3c99197c65bf67a1b884db78e70 (patch) | |
tree | 16c677d0d20105491b6acb4a5bf86cc2d813cf4d /share/hooks | |
parent | 0c3f19cf25e2f628fb54cbf2c0004b1703cadb5e (diff) | |
download | vyos-live-build-eeb4680557c5f3c99197c65bf67a1b884db78e70.tar.gz vyos-live-build-eeb4680557c5f3c99197c65bf67a1b884db78e70.zip |
Truncate /etc/machine-id instead of deleting it.
If /etc/machine-id exists but is empty, systemd will do tricks
with bind-mounts to ensure that a valid transient UUID is bind-mounted
over it, which is exactly what we want for a live system.
If /etc/machine-id does not exist, systemd-journald
will just fail, which is undesirable.
Diffstat (limited to 'share/hooks')
-rwxr-xr-x | share/hooks/0180-remove-systemd-machine-id.hook.chroot | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/share/hooks/0180-remove-systemd-machine-id.hook.chroot b/share/hooks/0180-remove-systemd-machine-id.hook.chroot index 52ba38fd4..ed5d6bf6a 100755 --- a/share/hooks/0180-remove-systemd-machine-id.hook.chroot +++ b/share/hooks/0180-remove-systemd-machine-id.hook.chroot @@ -2,8 +2,12 @@ set -e -# Remove systemd machine id. -# -# This removes systemd machine id that cache that makes each system unique. +# Blank out systemd machine id. If it does not exist, systemd-journald +# will fail, but if it exists and is empty, systemd will automatically +# set up a new unique ID. -rm -f /etc/machine-id +if [ -e /etc/machine-id ] +then + rm -f /etc/machine-id + : > /etc/machine-id +fi |