diskimage-builder/diskimage_builder/elements/sysprep/finalise.d/99-clear-machine-id

23 lines
693 B
Plaintext
Raw Normal View History

#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
if [ -e /var/lib/dbus/machine-id ]; then
> /var/lib/dbus/machine-id
fi
# According to documented First Boot Semantics writing "uninitialized" will trigger the full
# first boot behaviour.
# https://www.freedesktop.org/software/systemd/man/machine-id.html#First%20Boot%20Semantics
# On older versions of systemd before first boot semantics were formalised, any non-uuid value
# will trigger a new machine-id to be generated, so "uninitialized" also works.
# Previously this was done here by truncating /etc/machine-id.
if [ -e /etc/machine-id ]; then
echo uninitialized > /etc/machine-id
fi