From a0da8e8631f6b423b919dd774e0bb4e4449a2909 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 8 Nov 2016 10:04:47 +0100 Subject: do not duplicate hostname on every reboot --- hook/hostname | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'hook') diff --git a/hook/hostname b/hook/hostname index 7b6e331..0ef6f6f 100644 --- a/hook/hostname +++ b/hook/hostname @@ -5,7 +5,10 @@ run_latehook() { /usr/bin/systemd-machine-id-setup --root="${newroot}" - hostprefix="$(cat "${newroot}/etc/hostname")" + if [[ ! -s "${newroot}/etc/hostprefix" ]]; then + cp "${newroot}/etc/hostname" "${newroot}/etc/hostprefix" + fi + hostprefix="$(cat "${newroot}/etc/hostprefix")" if [[ -n "${hostname}" ]]; then msg ":: Setting hostname for main system to '${hostprefix}-${hostname}'..." -- cgit v1.2.3-70-g09d2