Subversion Repositories ALCASAR

Rev

Rev 841 | Go to most recent revision | Details | Last modification | View Log

Rev Author Line No. Line
838 richard 1
#/bin/bash
2
# $Id: alcasar-nf.sh 791 2012-01-13 21:31:36Z richard $
3
 
4
# alcasar-dhcp.sh
5
# by Rexy
6
# This script is distributed under the Gnu General Public License (GPL)
7
 
8
# active ou desactive le service DHCP sur le réseau de consultation
9
# enable or disable the DHCP service on consultation LAN
10
 
11
SED="/bin/sed -i"
12
ALCASAR_CONF_FILE="/usr/local/etc/alcasar.conf"
13
CHILLI_CONF_FILE="/etc/chilli.conf"
14
 
15
usage="Usage: alcasar-dhcp.sh {--on | -on} | {--off | -off}"
16
nb_args=$#
17
args=$1
18
if [ $nb_args -eq 0 ]
19
then
20
	echo "$usage"
21
	exit 1
22
fi
23
case $args in
24
	-\? | -h* | --h*)
25
		echo "$usage"
26
		exit 0
27
		;;
28
	-on|-on) # enable DHCP service
29
		$SED "s?^#statip.*?statip?g" $CHILLI_CONF_FILE
30
		$SED "s?^dhcpif.*?#dhcpif\teth1?g" $CHILLI_CONF_FILE
31
		$SED "s?^dynip.*?#dynip\t$network?g" $CHILLI_CONF_FILE
32
		$SED "s?^DHCP.*?DHCP=on?g" $ALCASAR_CONF_FILE
33
		/etc/init.d/chilli restart
34
		;;
35
	--off|-off) # disable DHCP service
36
		$SED "s?^DHCP.*?DHCP=off?g" $ALCASAR_CONF_FILE
37
		/etc/init.d/chilli restart
38
		;;
39
	*)
40
		echo "Argument inconnu :$1";
41
		echo "$usage"
42
		exit 1
43
		;;
44
esac
45