Subversion Repositories ALCASAR

Rev

Go to most recent revision | Blame | Last modification | View Log

#/bin/bash
# $Id: alcasar-nf.sh 791 2012-01-13 21:31:36Z richard $

# alcasar-dhcp.sh
# by Rexy
# This script is distributed under the Gnu General Public License (GPL)

# active ou desactive le service DHCP sur le réseau de consultation
# enable or disable the DHCP service on consultation LAN

SED="/bin/sed -i"
ALCASAR_CONF_FILE="/usr/local/etc/alcasar.conf"
CHILLI_CONF_FILE="/etc/chilli.conf"

usage="Usage: alcasar-dhcp.sh {--on | -on} | {--off | -off}"
nb_args=$#
args=$1
if [ $nb_args -eq 0 ]
then
        echo "$usage"
        exit 1
fi
case $args in
        -\? | -h* | --h*)
                echo "$usage"
                exit 0
                ;;
        -on|-on) # enable DHCP service
                $SED "s?^#statip.*?statip?g" $CHILLI_CONF_FILE
                $SED "s?^dhcpif.*?#dhcpif\teth1?g" $CHILLI_CONF_FILE
                $SED "s?^dynip.*?#dynip\t$network?g" $CHILLI_CONF_FILE
                $SED "s?^DHCP.*?DHCP=on?g" $ALCASAR_CONF_FILE
                /etc/init.d/chilli restart
                ;;
        --off|-off) # disable DHCP service
                $SED "s?^DHCP.*?DHCP=off?g" $ALCASAR_CONF_FILE
                /etc/init.d/chilli restart
                ;;
        *)
                echo "Argument inconnu :$1";
                echo "$usage"
                exit 1
                ;;
esac