slitaz-boot-scripts view etc/init.d/network.sh @ rev 8

Add network init script and config file
author Christophe Lincoln <pankso@slitaz.org>
date Fri Nov 30 12:34:07 2007 +0100 (2007-11-30)
parents
children f1529c400e81
line source
1 #!/bin/sh
2 # /etc/init.d/network.sh - Network initialisation boot script.
3 # Config file is: /etc/network.conf
4 #
5 . /etc/init.d/rc.functions
6 . /etc/network.conf
8 # Set hostname.
9 echo -n "Setting hostname... "
10 /bin/hostname -F /etc/hostname
11 status
13 # Configure loopback interface.
14 echo -n "Configure loopback... "
15 /sbin/ifconfig lo 127.0.0.1 up
16 /sbin/route add 127.0.0.1 lo
17 status
19 # For a dynamic IP with DHCP.
20 if [ "$DHCP" = "yes" ] ; then
21 echo "Starting udhcpc client on: $INTERFACE... "
22 /sbin/udhcpc -b -i $INTERFACE -p /var/run/udhcpc.$INTERFACE.pid
23 fi
25 # For a static IP.
26 if [ "$STATIC" = "yes" ] ; then
27 echo "Configuring static IP on $INTERFACE: $IP... "
28 /sbin/ifconfig $INTERFACE $IP netmask $NETMASK up
29 /sbin/route add default gateway $GATEWAY
30 echo "nameserver $DNS_SERVER" > /etc/resolv.conf
31 fi