Subversion Repositories ALCASAR

Rev

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

Rev 2833 Rev 2834
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
#  $Id: alcasar.sh 2833 2020-06-14 10:13:18Z rexy $
2
#  $Id: alcasar.sh 2834 2020-06-14 21:03:13Z rexy $
3
 
3
 
4
# alcasar.sh
4
# alcasar.sh
5
# ALCASAR is a Free and open source NAC created by Franck BOUIJOUX (3abtux), Pascal LEVANT and Richard REY (Rexy)
5
# ALCASAR is a Free and open source NAC created by Franck BOUIJOUX (3abtux), Pascal LEVANT and Richard REY (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
#  team@alcasar.net
7
#  team@alcasar.net
Line 531... Line 531...
531
			done
531
			done
532
		else
532
		else
533
			PRIVATE_IP_MASK=$DEFAULT_PRIVATE_IP_MASK
533
			PRIVATE_IP_MASK=$DEFAULT_PRIVATE_IP_MASK
534
		fi
534
		fi
535
	else
535
	else
536
		PRIVATE_IP_MASK=`grep ^PRIVATE_IP= conf/etc/alcasar.conf|cut -d"=" -f2`
536
		PRIVATE_IP_MASK=`grep ^PRIVATE_IP= /var/tmp/conf/etc/alcasar.conf|cut -d"=" -f2`
537
		rm -f conf/etc/alcasar.conf
537
		rm -rf /var/tmp/conf
538
	fi
538
	fi
539
# Define LAN side global parameters
539
# Define LAN side global parameters
540
	hostnamectl set-hostname $HOSTNAME.$DOMAIN
540
	hostnamectl set-hostname $HOSTNAME.$DOMAIN
541
	PRIVATE_NETWORK=`/bin/ipcalc -n $PRIVATE_IP_MASK | cut -d"=" -f2`				# private network address (ie.: 192.168.182.0)
541
	PRIVATE_NETWORK=`/bin/ipcalc -n $PRIVATE_IP_MASK | cut -d"=" -f2`				# private network address (ie.: 192.168.182.0)
542
	private_network_ending=`echo $PRIVATE_NETWORK | cut -d"." -f4`					# last octet of LAN address
542
	private_network_ending=`echo $PRIVATE_NETWORK | cut -d"." -f4`					# last octet of LAN address
Line 2379... Line 2379...
2379
	then
2379
	then
2380
		echo "*** 'debug' : end of cleaning ***"
2380
		echo "*** 'debug' : end of cleaning ***"
2381
		read
2381
		read
2382
	fi
2382
	fi
2383
# Test if manual update
2383
# Test if manual update
2384
		if [ -e /var/tmp/alcasar-conf*.tar.gz ] && [ "$mode" == "install" ]
2384
		if [ -e /var/tmp/alcasar-conf.tar.gz ] && [ "$mode" == "install" ]
2385
		then
2385
		then
2386
			header_install
-
 
2387
# Extract some info from the previous configuration file
2386
# Extract some info from the previous configuration file
-
 
2387
			cd /var/tmp
2388
			tar -xf /var/tmp/alcasar-conf* conf/etc/alcasar.conf
2388
			tar -xf /var/tmp/alcasar-conf.tar.gz conf/etc/alcasar.conf
-
 
2389
			cd $DIR_INSTALL
-
 
2390
			if [ "mode" == "install" ]
-
 
2391
			then
-
 
2392
				header_install
2389
			ORGANISME=`grep ^ORGANISM= conf/etc/alcasar.conf|cut -d"=" -f2`
2393
				ORGANISME=`grep ^ORGANISM= conf/etc/alcasar.conf|cut -d"=" -f2`
2390
			PREVIOUS_VERSION=`grep ^VERSION= conf/etc/alcasar.conf|cut -d"=" -f2`
2394
				PREVIOUS_VERSION=`grep ^VERSION= conf/etc/alcasar.conf|cut -d"=" -f2`
2391
			MAJ_PREVIOUS_VERSION=`echo $PREVIOUS_VERSION|cut -d"." -f1`
2395
				MAJ_PREVIOUS_VERSION=`echo $PREVIOUS_VERSION|cut -d"." -f1`
2392
			MIN_PREVIOUS_VERSION=`echo $PREVIOUS_VERSION|cut -d"." -f2`
2396
				MIN_PREVIOUS_VERSION=`echo $PREVIOUS_VERSION|cut -d"." -f2`
2393
			UPD_PREVIOUS_VERSION=`echo $PREVIOUS_VERSION|cut -d"." -f3|cut -c1`
2397
				UPD_PREVIOUS_VERSION=`echo $PREVIOUS_VERSION|cut -d"." -f3|cut -c1`
2394
			if [ $Lang == "fr" ]
-
 
2395
				then echo "Le fichier de configuration d'une version $MAJ_PREVIOUS_VERSION.$MIN_PREVIOUS_VERSION.$UPD_PREVIOUS_VERSION a été trouvé";
-
 
2396
				else echo "The configuration file of an old version has been found";
-
 
2397
			fi
-
 
2398
			response=0
-
 
2399
			PTN='^[oOnNyY]?$'
-
 
2400
			until [[ "$response" =~ $PTN ]]
-
 
2401
			do
-
 
2402
				if [ $Lang == "fr" ]
2398
				if [ $Lang == "fr" ]
2403
					then echo -n "Voulez-vous l'utiliser (O/n)? ";
2399
					then echo "Le fichier de configuration d'une version $MAJ_PREVIOUS_VERSION.$MIN_PREVIOUS_VERSION.$UPD_PREVIOUS_VERSION a été trouvé";
2404
					else echo -n "Do you want to use it (Y/n)?";
2400
					else echo "The configuration file of an old version has been found";
2405
				 fi
-
 
2406
				read response
-
 
2407
				if [ "$response" = "n" ] || [ "$response" = "N" ]
-
 
2408
				then rm -f /var/tmp/alcasar-conf*
-
 
2409
				fi
2401
				fi
-
 
2402
				response=0
-
 
2403
				PTN='^[oOnNyY]?$'
-
 
2404
				until [[ "$response" =~ $PTN ]]
-
 
2405
				do
-
 
2406
					if [ $Lang == "fr" ]
-
 
2407
						then echo -n "Voulez-vous l'utiliser (O/n)? ";
-
 
2408
						else echo -n "Do you want to use it (Y/n)?";
-
 
2409
					fi
-
 
2410
					read response
-
 
2411
					if [ "$response" = "n" ] || [ "$response" = "N" ]
-
 
2412
					then
-
 
2413
						rm -f /var/tmp/alcasar-conf*
-
 
2414
						rm -rf /var/tmp/conf
-
 
2415
					fi
2410
			done
2416
				done
-
 
2417
			fi
2411
		fi
2418
		fi
2412
# Test if update
2419
# Test if update
2413
		if [ -e /var/tmp/alcasar-conf* ]
2420
		if [ -e /var/tmp/alcasar-conf.tar.gz ]
2414
		then
2421
		then
2415
			if [ $Lang == "fr" ]
2422
			if [ $Lang == "fr" ]
2416
				then echo "#### Installation avec mise à jour ####";
2423
				then echo "#### Installation avec mise à jour ####";
2417
				else echo "#### Installation with update     ####";
2424
				else echo "#### Installation with update     ####";
2418
			fi
2425
			fi