]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/initscripts/system/localnet
firewall: Configure TRACE target to log to syslog
[people/pmueller/ipfire-2.x.git] / src / initscripts / system / localnet
1 #!/bin/sh
2 ########################################################################
3 # Begin $rc_base/init.d/localnet
4 #
5 # Description : Loopback device
6 #
7 # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
8 #
9 # Version : 00.00
10 #
11 # Notes :
12 #
13 ########################################################################
14
15 . /etc/sysconfig/rc
16 . ${rc_functions}
17
18 write_resolv_conf() {
19 (
20 [ -n "${DOMAINNAME}" ] && echo "search ${DOMAINNAME}"
21 echo "nameserver 127.0.0.1"
22 echo "options trust-ad"
23 ) > /etc/resolv.conf
24 }
25
26 write_hosts() {
27 (
28 echo "127.0.0.1 localhost.localdomain localhost"
29 ) > /etc/hosts
30 }
31
32 case "${1}" in
33 start)
34 eval $(/usr/local/bin/readhash /var/ipfire/main/settings)
35 boot_mesg "Bringing up the loopback interface..."
36 ip addr add 127.0.0.1/8 label lo dev lo
37 ip link set lo up
38 evaluate_retval
39
40 boot_mesg "Setting hostname to ${HOSTNAME}.${DOMAINNAME}..."
41 hostname "${HOSTNAME}.${DOMAINNAME}"
42 evaluate_retval
43
44 # Update hosts
45 write_hosts
46
47 # Update resolv.conf
48 write_resolv_conf
49 ;;
50
51 stop)
52 boot_mesg "Bringing down the loopback interface..."
53 ip link set lo down
54 evaluate_retval
55 ;;
56
57 restart)
58 ${0} stop
59 sleep 1
60 ${0} start
61 ;;
62
63 status)
64 eval $(/usr/local/bin/readhash /var/ipfire/main/settings)
65 echo "Hostname is: $(hostname)"
66 ip link show lo
67 ;;
68
69 *)
70 echo "Usage: ${0} {start|stop|restart|status}"
71 exit 1
72 ;;
73 esac
74
75 # End $rc_base/init.d/localnet