Subversion Repositories ALCASAR

Rev

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

Rev 1419 Rev 1460
Line 1... Line 1...
1
#/bin/bash
1
#/bin/bash
2
# $Id: alcasar-conf.sh 1419 2014-07-24 15:40:16Z richard $
2
# $Id: alcasar-conf.sh 1460 2014-09-22 19:17:15Z franck $
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 48... Line 48...
48
	private_network_ending=`echo $PRIVATE_NETWORK | cut -d"." -f$classe_sup`				# last octet of LAN address
48
	private_network_ending=`echo $PRIVATE_NETWORK | cut -d"." -f$classe_sup`				# last octet of LAN address
49
	private_broadcast_ending=`echo $PRIVATE_BROADCAST | cut -d"." -f$classe_sup`				# last octet of LAN broadcast
49
	private_broadcast_ending=`echo $PRIVATE_BROADCAST | cut -d"." -f$classe_sup`				# last octet of LAN broadcast
50
	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_FIRST_IP=`echo $PRIVATE_NETWORK | cut -d"." -f1-3`"."`expr $private_network_ending + 1`		# First network address (ex.: 192.168.182.1)
51
	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_SECOND_IP=`echo $PRIVATE_NETWORK | cut -d"." -f1-3`"."`expr $private_network_ending + 2`	# second network address (ex.: 192.168.182.2)
52
	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_LAST_IP=`echo $PRIVATE_BROADCAST | cut -d"." -f1-3`"."`expr $private_broadcast_ending - 1`	# last network address (ex.: 192.168.182.254)
-
 
53
	PRIVATE_MAC=`/sbin/ip link show $INTIF | grep ether | cut -d" " -f6`				# MAC address of INTIF
53
}
54
}
54
 
55
 
55
usage="Usage: alcasar-conf.sh {--create or -create} | {--load or -load} | {--apply or -apply}"
56
usage="Usage: alcasar-conf.sh {--create or -create} | {--load or -load} | {--apply or -apply}"
56
nb_args=$#
57
nb_args=$#
57
args=$1
58
args=$1
Line 252... Line 253...
252
		private_network_calc
253
		private_network_calc
253
		INSTALL_DATE=`grep INSTALL_DATE $CONF_FILE|cut -d"=" -f2`
254
		INSTALL_DATE=`grep INSTALL_DATE $CONF_FILE|cut -d"=" -f2`
254
		ORGANISME=`grep ORGANISM $CONF_FILE|cut -d"=" -f2`
255
		ORGANISME=`grep ORGANISM $CONF_FILE|cut -d"=" -f2`
255
 		DOMAIN=`grep DOMAIN $CONF_FILE|cut -d"=" -f2`
256
 		DOMAIN=`grep DOMAIN $CONF_FILE|cut -d"=" -f2`
256
		DHCP_mode=`grep DHCP= $CONF_FILE|cut -d"=" -f2`
257
		DHCP_mode=`grep DHCP= $CONF_FILE|cut -d"=" -f2`
-
 
258
		# create file for DHCP static ip. Reserve the second IP address for INTIF (the first one is for tun0)
-
 
259
		echo "$PRIVATE_MAC $PRIVATE_SECOND_IP" > $DIR_ETC/alcasar-ethers
257
		if [ "$PARENT_SCRIPT" != "alcasar.sh" ] # don't launch on install stage
260
		if [ "$PARENT_SCRIPT" != "alcasar.sh" ] # don't launch on install stage
258
		then
261
		then
259
			if [ $DHCP_mode = "off" ]
262
			if [ $DHCP_mode = "off" ]
260
			then
263
			then
261
				$DIR_SBIN/alcasar-dhcp.sh --off
264
				$DIR_SBIN/alcasar-dhcp.sh --off