1dbb8978e4ee80eecd28d859dd27d6eae4407895
[live-initramfs-grml.git] / scripts / live-bottom / 18hostname
1 #!/bin/sh
2
3 #set -e
4
5 # initramfs-tools header
6
7 PREREQ=""
8
9 prereqs()
10 {
11         echo "${PREREQ}"
12 }
13
14 case "${1}" in
15         prereqs)
16                 prereqs
17                 exit 0
18                 ;;
19 esac
20
21 # live-initramfs header
22
23 if [ -n "${NOHOSTS}" ]
24 then
25         exit 0
26 fi
27
28 . /scripts/live-functions
29
30 log_begin_msg "Setting hostname..."
31
32 # live-initramfs script
33
34 echo "${HOSTNAME}" > /root/etc/hostname
35
36 cat >> /root/etc/hosts << EOF
37 127.0.0.1 localhost
38 127.0.1.1 ${HOSTNAME}
39
40 # The following lines are desirable for IPv6 capable hosts
41 ::1     ip6-localhost ip6-loopback
42 fe00::0 ip6-localnet
43 ff00::0 ip6-mcastprefix
44 ff02::1 ip6-allnodes
45 ff02::2 ip6-allrouters
46 ff02::3 ip6-allhosts
47 EOF
48
49 log_end_msg