Subversion Repositories ALCASAR

Rev

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

Rev 1579 Rev 1581
Line 1... Line 1...
1
#/bin/bash
1
#/bin/bash
2
# $Id: alcasar-conf.sh 1579 2015-03-03 18:18:05Z richard $
2
# $Id: alcasar-conf.sh 1581 2015-03-03 22:36:58Z richard $
3
 
3
 
4
# alcasar-conf.sh
4
# alcasar-conf.sh
5
# by REXY
5
# by REXY
6
# This script is distributed under the Gnu General Public License (GPL)
6
# This script is distributed under the Gnu General Public License (GPL)
7
 
7
 
Line 47... Line 47...
47
	private_network_ending=`echo $PRIVATE_NETWORK | cut -d"." -f$classe_sup`				# last octet of LAN address
47
	private_network_ending=`echo $PRIVATE_NETWORK | cut -d"." -f$classe_sup`				# last octet of LAN address
48
	private_broadcast_ending=`echo $PRIVATE_BROADCAST | cut -d"." -f$classe_sup`				# last octet of LAN broadcast
48
	private_broadcast_ending=`echo $PRIVATE_BROADCAST | cut -d"." -f$classe_sup`				# last octet of LAN broadcast
49
	PRIVATE_FIRST_IP=`echo $PRIVATE_NETWORK | cut -d"." -f1-3`"."`expr $private_network_ending + 1`		# First network address (ex.: 192.168.182.1)
49
	PRIVATE_FIRST_IP=`echo $PRIVATE_NETWORK | cut -d"." -f1-3`"."`expr $private_network_ending + 1`		# First network address (ex.: 192.168.182.1)
50
	PRIVATE_SECOND_IP=`echo $PRIVATE_NETWORK | cut -d"." -f1-3`"."`expr $private_network_ending + 2`	# second network address (ex.: 192.168.182.2)
50
	PRIVATE_SECOND_IP=`echo $PRIVATE_NETWORK | cut -d"." -f1-3`"."`expr $private_network_ending + 2`	# second network address (ex.: 192.168.182.2)
51
	PRIVATE_LAST_IP=`echo $PRIVATE_BROADCAST | cut -d"." -f1-3`"."`expr $private_broadcast_ending - 1`	# last network address (ex.: 192.168.182.254)
51
	PRIVATE_LAST_IP=`echo $PRIVATE_BROADCAST | cut -d"." -f1-3`"."`expr $private_broadcast_ending - 1`	# last network address (ex.: 192.168.182.254)
52
	PRIVATE_MAC=`/sbin/ip link show $INTIF | grep ether | cut -d" " -f6`				# MAC address of INTIF
52
	PRIVATE_MAC=`/sbin/ip link show $INTIF | grep ether | cut -d" " -f6| sed 's/:/-/g'| awk '{print toupper($0)}'`	# MAC address of INTIF
53
}
53
}
54
 
54
 
55
usage="Usage: alcasar-conf.sh {--create or -create} | {--load or -load} | {--apply or -apply}"
55
usage="Usage: alcasar-conf.sh {--create or -create} | {--load or -load} | {--apply or -apply}"
56
nb_args=$#
56
nb_args=$#
57
args=$1
57
args=$1
Line 200... Line 200...
200
		private_network_calc
200
		private_network_calc
201
		INSTALL_DATE=`grep INSTALL_DATE $CONF_FILE|cut -d"=" -f2`
201
		INSTALL_DATE=`grep INSTALL_DATE $CONF_FILE|cut -d"=" -f2`
202
		ORGANISME=`grep ORGANISM $CONF_FILE|cut -d"=" -f2`
202
		ORGANISME=`grep ORGANISM $CONF_FILE|cut -d"=" -f2`
203
 		DOMAIN=`grep DOMAIN $CONF_FILE|cut -d"=" -f2`
203
 		DOMAIN=`grep DOMAIN $CONF_FILE|cut -d"=" -f2`
204
		DHCP_mode=`grep DHCP= $CONF_FILE|cut -d"=" -f2`
204
		DHCP_mode=`grep DHCP= $CONF_FILE|cut -d"=" -f2`
205
		# create file for DHCP static ip. Reserve the second IP address for INTIF (the first one is for tun0)
-
 
206
		echo "$PRIVATE_MAC $PRIVATE_SECOND_IP" > $DIR_ETC/alcasar-ethers
-
 
207
		if [ "$PARENT_SCRIPT" != "alcasar.sh" ] # don't launch on install stage
205
		if [ "$PARENT_SCRIPT" != "alcasar.sh" ] # don't launch on install stage
208
		then
206
		then
209
			if [ $DHCP_mode = "off" ]
207
			if [ $DHCP_mode = "off" ]
210
			then
208
			then
211
				$DIR_SBIN/alcasar-dhcp.sh --off
209
				$DIR_SBIN/alcasar-dhcp.sh --off
Line 253... Line 251...
253
# coova
251
# coova
254
		$SED "s?^net.*?net\t\t$PRIVATE_NETWORK_MASK?g" /etc/chilli.conf
252
		$SED "s?^net.*?net\t\t$PRIVATE_NETWORK_MASK?g" /etc/chilli.conf
255
		$SED "s?^dns1.*?dns1\t\t$PRIVATE_IP?g" /etc/chilli.conf
253
		$SED "s?^dns1.*?dns1\t\t$PRIVATE_IP?g" /etc/chilli.conf
256
		$SED "s?^dns2.*?dns2\t\t$PRIVATE_IP?g" /etc/chilli.conf
254
		$SED "s?^dns2.*?dns2\t\t$PRIVATE_IP?g" /etc/chilli.conf
257
		$SED "s?^uamlisten.*?uamlisten\t$PRIVATE_IP?g" /etc/chilli.conf
255
		$SED "s?^uamlisten.*?uamlisten\t$PRIVATE_IP?g" /etc/chilli.conf
-
 
256
		# modify the DHCP static ip file. Reserve the second IP address for INTIF (the first one is for tun0). Keep previous entries
-
 
257
		$SED "s?^$PRIVATE_MAC.*?$PRIVATE_MAC $PRIVATE_SECOND_IP?" $DIR_ETC/alcasar-ethers
258
# dnsmasq
258
# dnsmasq
259
		$SED "/127.0.0.1/!s?^listen-address=.*?listen-address=$PRIVATE_IP?g" /etc/dnsmasq.conf /etc/dnsmasq-blacklist.conf /etc/dnsmasq-whitelist.conf
259
		$SED "/127.0.0.1/!s?^listen-address=.*?listen-address=$PRIVATE_IP?g" /etc/dnsmasq.conf /etc/dnsmasq-blacklist.conf /etc/dnsmasq-whitelist.conf
260
		for i in /etc/dnsmasq.conf /etc/dnsmasq-blacklist.conf
260
		for i in /etc/dnsmasq.conf /etc/dnsmasq-blacklist.conf
261
		do
261
		do
262
			$SED "/^server=/d" $i
262
			$SED "/^server=/d" $i