slitaz-boot-scripts diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/etc/init.d/network.sh	Fri Nov 30 12:34:07 2007 +0100
     1.3 @@ -0,0 +1,32 @@
     1.4 +#!/bin/sh
     1.5 +# /etc/init.d/network.sh - Network initialisation boot script.
     1.6 +# Config file is: /etc/network.conf
     1.7 +#
     1.8 +. /etc/init.d/rc.functions
     1.9 +. /etc/network.conf
    1.10 +
    1.11 +# Set hostname.
    1.12 +echo -n "Setting hostname... "
    1.13 +/bin/hostname -F /etc/hostname
    1.14 +status
    1.15 +
    1.16 +# Configure loopback interface.
    1.17 +echo -n "Configure loopback... "
    1.18 +/sbin/ifconfig lo 127.0.0.1 up
    1.19 +/sbin/route add 127.0.0.1 lo
    1.20 +status
    1.21 +
    1.22 +# For a dynamic IP with DHCP.
    1.23 +if [ "$DHCP" = "yes" ] ; then
    1.24 +  echo "Starting udhcpc client on: $INTERFACE... "
    1.25 +  /sbin/udhcpc -b -i $INTERFACE -p /var/run/udhcpc.$INTERFACE.pid
    1.26 +fi
    1.27 +
    1.28 +# For a static IP.
    1.29 +if [ "$STATIC" = "yes" ] ; then
    1.30 +  echo "Configuring static IP on $INTERFACE: $IP... "
    1.31 +  /sbin/ifconfig $INTERFACE $IP netmask $NETMASK up
    1.32 +  /sbin/route add default gateway $GATEWAY
    1.33 +  echo "nameserver $DNS_SERVER" > /etc/resolv.conf
    1.34 +fi
    1.35 +