Subversion Repositories ALCASAR

Rev

Rev 2474 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2474 Rev 2688
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-dhcp.sh 2474 2017-12-30 02:00:04Z tom.houdayer $
2
# $Id: alcasar-dhcp.sh 2688 2019-01-18 23:15:49Z lucas.echard $
3
 
3
 
4
# alcasar-dhcp.sh
4
# alcasar-dhcp.sh
5
 
5
 
6
# by Rexy
6
# by Rexy
7
# This script is distributed under the Gnu General Public License (GPL)
7
# This script is distributed under the Gnu General Public License (GPL)
Line 10... Line 10...
10
# enable or disable the DHCP service on consultation LAN
10
# enable or disable the DHCP service on consultation LAN
11
 
11
 
12
SED="/bin/sed -i"
12
SED="/bin/sed -i"
13
CHILLI_CONF_FILE="/etc/chilli.conf"
13
CHILLI_CONF_FILE="/etc/chilli.conf"
14
ALCASAR_CONF_FILE="/usr/local/etc/alcasar.conf"
14
ALCASAR_CONF_FILE="/usr/local/etc/alcasar.conf"
15
DNSMASQ_CONF_FILE="/etc/dnsmasq.conf"
-
 
16
 
15
 
17
# define DHCP parameters (LAN side)
16
# define DHCP parameters (LAN side)
18
PRIVATE_IP_MASK=`grep ^PRIVATE_IP= $ALCASAR_CONF_FILE|cut -d"=" -f2`
17
PRIVATE_IP_MASK=`grep ^PRIVATE_IP= $ALCASAR_CONF_FILE|cut -d"=" -f2`
19
PRIVATE_IP=`echo $PRIVATE_IP_MASK | cut -d"/" -f1`
18
PRIVATE_IP=`echo $PRIVATE_IP_MASK | cut -d"/" -f1`
20
PRIVATE_PREFIX=`/bin/ipcalc -p $PRIVATE_IP_MASK |cut -d"=" -f2`				# network prefix (ie. 24)
19
PRIVATE_PREFIX=`/bin/ipcalc -p $PRIVATE_IP_MASK |cut -d"=" -f2`				# network prefix (ie. 24)
Line 70... Line 69...
70
		$SED "s?^.*statip.*?#statip?g" $CHILLI_CONF_FILE
69
		$SED "s?^.*statip.*?#statip?g" $CHILLI_CONF_FILE
71
		$SED "s?^nodynip.*?#nodynip?g" $CHILLI_CONF_FILE
70
		$SED "s?^nodynip.*?#nodynip?g" $CHILLI_CONF_FILE
72
		$SED "s?^DHCP.*?DHCP=on?g" $ALCASAR_CONF_FILE
71
		$SED "s?^DHCP.*?DHCP=on?g" $ALCASAR_CONF_FILE
73
		$SED "s?^dynip.*?dynip\t\t$PRIVATE_NETWORK_MASK?g" $CHILLI_CONF_FILE
72
		$SED "s?^dynip.*?dynip\t\t$PRIVATE_NETWORK_MASK?g" $CHILLI_CONF_FILE
74
		$SED "s?^#dynip.*?dynip\t\t$PRIVATE_NETWORK_MASK?g" $CHILLI_CONF_FILE
73
		$SED "s?^#dynip.*?dynip\t\t$PRIVATE_NETWORK_MASK?g" $CHILLI_CONF_FILE
75
		$SED "s?^dhcp_range.*?dhcp-range=$PRIVATE_FIRST_IP,$PRIVATE_LAST_IP,$PRIVATE_NETMASK,12h?g" $DNSMASQ_CONF_FILE
-
 
76
		$SED "s?^dhcpgateway\t.*?#dhcpgateway\t\t $EXT_DHCP_IP?g" $CHILLI_CONF_FILE
74
		$SED "s?^dhcpgateway\t.*?#dhcpgateway\t\t $EXT_DHCP_IP?g" $CHILLI_CONF_FILE
77
		$SED "s?^dhcprelayagent.*?#dhcprelayagent\t\t$RELAY_DHCP_IP?g" $CHILLI_CONF_FILE
75
		$SED "s?^dhcprelayagent.*?#dhcprelayagent\t\t$RELAY_DHCP_IP?g" $CHILLI_CONF_FILE
78
		$SED "s?^dhcpgatewayport.*?#dhcpgatewayport\t\t$RELAY_DHCP_PORT?g" $CHILLI_CONF_FILE
76
		$SED "s?^dhcpgatewayport.*?#dhcpgatewayport\t\t$RELAY_DHCP_PORT?g" $CHILLI_CONF_FILE
79
		$SED "s?^EXT_DHCP_IP.*?EXT_DHCP_IP=$EXT_DHCP_IP?g" $ALCASAR_CONF_FILE
77
		$SED "s?^EXT_DHCP_IP.*?EXT_DHCP_IP=$EXT_DHCP_IP?g" $ALCASAR_CONF_FILE
80
		$SED "s?^RELAY_DHCP_IP.*?RELAY_DHCP_IP=$RELAY_DHCP_IP?g" $ALCASAR_CONF_FILE
78
		$SED "s?^RELAY_DHCP_IP.*?RELAY_DHCP_IP=$RELAY_DHCP_IP?g" $ALCASAR_CONF_FILE
Line 85... Line 83...
85
		echo "Argument inconnu :$1";
83
		echo "Argument inconnu :$1";
86
		echo "$usage"
84
		echo "$usage"
87
		exit 1
85
		exit 1
88
		;;
86
		;;
89
esac
87
esac
90
 
-