From: Benjamin Drung Date: Wed, 21 Aug 2019 14:52:54 +0000 (+0200) Subject: Create /etc/hostname in initramfs X-Git-Tag: debian/1%20210122~14^2~1 X-Git-Url: http://git.grml.org/?p=live-boot-grml.git;a=commitdiff_plain;h=44c651dc8dcaaa41bb57dba636db97d4fe04bea8 Create /etc/hostname in initramfs Persist hostname in /etc/hostname in the initramfs if the hostname is known. Signed-off-by: Benjamin Drung --- diff --git a/components/9990-networking.sh b/components/9990-networking.sh index cfafcb0..92c66ee 100755 --- a/components/9990-networking.sh +++ b/components/9990-networking.sh @@ -133,6 +133,12 @@ do_netsetup () HWADDR="$(cat "/sys/class/net/${interface}/address")" fi + if [ ! -e "/etc/hostname" ] && [ -n "${HOSTNAME}" ] + then + echo "Creating /etc/hostname" + echo "${HOSTNAME}" > /etc/hostname + fi + # Only create /etc/hosts if FQDN is known (to let 'hostname -f' query # this file). Otherwise DNS will be queried to determine the FQDN. if [ ! -e "/etc/hosts" ] && [ -n "${DNSDOMAIN}" ]