summaryrefslogtreecommitdiffstats
path: root/hook
diff options
context:
space:
mode:
Diffstat (limited to 'hook')
-rw-r--r--hook/hostname5
1 files changed, 4 insertions, 1 deletions
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}'..."