5 # initramfs-tools header
21 # live-initramfs header
23 if [ -n "${NOHOSTS}" ]
28 . /scripts/live-functions
30 log_begin_msg "Setting hostname"
32 # live-initramfs script
34 # Change hostname only if it is not set
35 if [ ! -f /root/etc/hostname ] || grep -qs localhost\.localdomain /root/etc/hostname
37 echo "${HOSTNAME}" > /root/etc/hostname
39 HOSTNAME="$(cat /root/etc/hostname)"
40 really_export HOSTNAME
43 # Create /etc/hosts only if it is not present or empty
44 if [ ! -s /root/etc/hosts ]
46 cat > /root/etc/hosts << EOF
50 # The following lines are desirable for IPv6 capable hosts
51 ::1 ip6-localhost ip6-loopback
53 ff00::0 ip6-mcastprefix
55 ff02::2 ip6-allrouters
60 hostname "${HOSTNAME}"