summaryrefslogtreecommitdiffstats
path: root/hook/hostname
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2016-11-08 10:04:47 +0100
committerGravatar Christian Hesse <mail@eworm.de>2016-11-08 10:04:47 +0100
commita0da8e8631f6b423b919dd774e0bb4e4449a2909 (patch)
tree8cff4e32a306bb6ec42ac1457346255d42781daf /hook/hostname
parentfc9d31039122afbd2eea19caca4d4b173d023554 (diff)
downloadmkinitcpio-hostname-a0da8e8631f6b423b919dd774e0bb4e4449a2909.tar.gz
mkinitcpio-hostname-a0da8e8631f6b423b919dd774e0bb4e4449a2909.tar.zst
do not duplicate hostname on every reboot
Diffstat (limited to 'hook/hostname')
-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}'..."