Subversion Repositories ALCASAR

Rev

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

Rev 2461 Rev 2464
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
#  $Id: alcasar.sh 2461 2017-12-14 23:01:41Z richard $
2
#  $Id: alcasar.sh 2464 2017-12-17 15:35:45Z richard $
3
 
3
 
4
# alcasar.sh
4
# alcasar.sh
5
 
5
 
6
# ALCASAR Install script -  CopyLeft ALCASAR Team [Rexy + 3abtux + Steweb + Crox + ...]
6
# ALCASAR Install script -  CopyLeft ALCASAR Team [Rexy + 3abtux + Steweb + Crox + ...]
7
# Ce programme est un logiciel libre ; This software is free and open source
7
# Ce programme est un logiciel libre ; This software is free and open source
Line 171... Line 171...
171
		PTN='^[12]$'
171
		PTN='^[12]$'
172
		until [[ $(expr $response : $PTN) -gt 0 ]]
172
		until [[ $(expr $response : $PTN) -gt 0 ]]
173
		do
173
		do
174
			if [ $Lang == "fr" ]
174
			if [ $Lang == "fr" ]
175
			then
175
			then
176
				echo "Effectuer une mise à jour : tapez '1'"
176
				echo -n "Tapez '1' pour une mise à jour; Tapez '2' pour une réinstallation : "
177
				echo -n "Effectuer une réinstallation : Tapez '2' : "
-
 
178
			else
177
			else
179
				echo "Perform an update : Hit '1'"
-
 
180
				echo -n "Perform a reinstallation : Hit '2' : "
178
				echo -n "Hit '1' for an update; Hit '2' for a reinstallation : "
181
			 fi
179
			 fi
182
			read response
180
			read response
183
		done
181
		done
184
		if [ "$response" = "2" ]
182
		if [ "$response" = "2" ]
185
		then
183
		then
Line 506... Line 504...
506
	private_broadcast_ending=`echo $PRIVATE_BROADCAST | cut -d"." -f4`				# last octet of LAN broadcast
504
	private_broadcast_ending=`echo $PRIVATE_BROADCAST | cut -d"." -f4`				# last octet of LAN broadcast
507
	PRIVATE_FIRST_IP=`echo $PRIVATE_NETWORK | cut -d"." -f1-3`"."`expr $private_network_ending + 1`	# First network address (ex.: 192.168.182.1)
505
	PRIVATE_FIRST_IP=`echo $PRIVATE_NETWORK | cut -d"." -f1-3`"."`expr $private_network_ending + 1`	# First network address (ex.: 192.168.182.1)
508
	PRIVATE_LAST_IP=`echo $PRIVATE_BROADCAST | cut -d"." -f1-3`"."`expr $private_broadcast_ending - 1`	# last network address (ex.: 192.168.182.254)
506
	PRIVATE_LAST_IP=`echo $PRIVATE_BROADCAST | cut -d"." -f1-3`"."`expr $private_broadcast_ending - 1`	# last network address (ex.: 192.168.182.254)
509
	PRIVATE_MAC=`/usr/sbin/ip link show $INTIF | grep ether | cut -d" " -f6| sed 's/:/-/g'| awk '{print toupper($0)}'` 	# MAC address of INTIF
507
	PRIVATE_MAC=`/usr/sbin/ip link show $INTIF | grep ether | cut -d" " -f6| sed 's/:/-/g'| awk '{print toupper($0)}'` 	# MAC address of INTIF
510
# Define Internet parameters
508
# Define Internet parameters
-
 
509
	if [ "$mode" != "update" ]
-
 
510
	then
511
	DNS1=`grep ^nameserver /etc/resolv.conf|awk -F" " '{print $2}'|head -n 1`	# 1st DNS server
511
		DNS1=`cat /etc/sysconfig/network-scripts/ifcfg-$EXTIF | grep '^DNS1='| cut -d"=" -f2`	# 1st DNS server
-
 
512
		DNS2=`cat /etc/sysconfig/network-scripts/ifcfg-$EXTIF | grep '^DNS2=' | cut -d"=" -f2`	# 2nd DNS server
-
 
513
	else
-
 
514
		DNS1=`cat /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF | grep '^DNS1=' | cut -d"=" -f2`	# 1st DNS server
-
 
515
		DNS2=`cat /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF | grep '^DNS2=' | cut -d"=" -f2`	# 2nd DNS server
-
 
516
	fi
512
	if [ "$DNS1" == "" ] || [ "$DNS1" == "127.0.0.1" ]
517
	if [ "$DNS1" == "" ]
513
	then
518
	then
514
		if [ $Lang == "fr" ]
519
		if [ $Lang == "fr" ]
515
		then
520
		then
516
		       	echo "L'adresse IP des serveurs DNS ne sont pas corrects"
521
			echo "L'adresse IP des serveurs DNS ne sont pas corrects"
517
			echo "Vérifiez la configuration de la carte réseau externe ($EXTIF)"
522
			echo "Vérifiez la configuration de la carte réseau externe ($EXTIF)"
518
		else
523
		else
519
		       	echo "The IP address of DNS servers are not set correctly"
524
			echo "The IP address of DNS servers are not set correctly"
520
			echo "Check the extern network card configuration ($EXTIF)"
525
			echo "Check the extern network card configuration ($EXTIF)"
521
		fi
526
		fi
522
		exit 0
527
		exit 0
523
	fi
528
	fi
524
	nb_dns=`grep -c ^nameserver /etc/resolv.conf`
-
 
525
	if [ $nb_dns == 2 ]
-
 
526
		then
-
 
527
		DNS2=`grep ^nameserver /etc/resolv.conf|cut -d" " -f2|tail -n 1`			# 2nd DNS server (if exist)
-
 
528
	fi
-
 
529
	DNS1=${DNS1:=208.67.220.220}
529
	DNS1=${DNS1:=208.67.220.220}
530
	DNS2=${DNS2:=208.67.222.222}
530
	DNS2=${DNS2:=208.67.222.222}
531
	PUBLIC_NETMASK=`/bin/ipcalc -m $PUBLIC_IP_MASK | cut -d"=" -f2`
531
	PUBLIC_NETMASK=`/bin/ipcalc -m $PUBLIC_IP_MASK | cut -d"=" -f2`
532
	PUBLIC_PREFIX=`/bin/ipcalc -p $PUBLIC_IP $PUBLIC_NETMASK|cut -d"=" -f2`
532
	PUBLIC_PREFIX=`/bin/ipcalc -p $PUBLIC_IP $PUBLIC_NETMASK|cut -d"=" -f2`
533
	PUBLIC_NETWORK=`/bin/ipcalc -n $PUBLIC_IP/$PUBLIC_PREFIX|cut -d"=" -f2`
533
	PUBLIC_NETWORK=`/bin/ipcalc -n $PUBLIC_IP/$PUBLIC_PREFIX|cut -d"=" -f2`