Subversion Repositories ALCASAR

Rev

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

Rev 2542 Rev 2549
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
#  $Id: alcasar.sh 2542 2018-05-04 17:12:28Z rexy $
2
#  $Id: alcasar.sh 2549 2018-05-06 02:27:57Z tom.houdayer $
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 182... Line 182...
182
		if [ "$response" = "2" ]
182
		if [ "$response" = "2" ]
183
		then
183
		then
184
			rm -f /tmp/alcasar-conf*
184
			rm -f /tmp/alcasar-conf*
185
		else
185
		else
186
# Retrieve former NICname
186
# Retrieve former NICname
187
			EXTIF=`grep ^EXTIF= $CONF_FILE|cut -d"=" -f2`				# EXTernal InterFace
187
			EXTIF_saved=`grep ^EXTIF= $CONF_FILE | cut -d'=' -f2-`	# EXTernal InterFace
188
			INTIF=`grep ^INTIF= $CONF_FILE|cut -d"=" -f2`				# INTernal InterFace
188
			INTIF_saved=`grep ^INTIF= $CONF_FILE | cut -d'=' -f2-`	# INTernal InterFace
-
 
189
			[ $(/usr/sbin/ip link | grep -c " $EXTIF_saved:") -ne 0 ] && EXTIF=$EXTIF_saved || echo "Warning: Network card \"$EXTIF_saved\" is not connected, so \"$EXTIF\" will be used for external network."
-
 
190
			[ $(/usr/sbin/ip link | grep -c " $INTIF_saved:") -ne 0 ] && INTIF=$INTIF_saved || echo "Warning: Network card \"$INTIF_saved\" is not connected, so \"$INTIF\" will be used for internal network."
189
# Create the current conf file
191
# Create the current conf file
190
			$DIR_SCRIPTS/alcasar-conf.sh --create
192
			$DIR_SCRIPTS/alcasar-conf.sh --create
191
			mode="update"
193
			mode="update"
192
		fi
194
		fi
193
	fi
195
	fi
Line 238... Line 240...
238
		exit 0
240
		exit 0
239
		fi
241
		fi
240
	fi
242
	fi
241
	if [ $Lang == "fr" ]
243
	if [ $Lang == "fr" ]
242
		then echo -n "Tests des paramètres réseau : "
244
		then echo -n "Tests des paramètres réseau : "
243
		else echo -n "Network parameters tests : "
245
		else echo -n "Network parameters tests: "
244
	fi
246
	fi
245
# Remove conf file if NIC is not plugged (ie : GSM/WIFI/Bt dongles)
247
# Remove conf file if NIC is not plugged (ie : GSM/WIFI/Bt dongles)
246
	cd /etc/sysconfig/network-scripts/
248
	cd /etc/sysconfig/network-scripts/
247
	IF_INTERFACES=`ls ifcfg-*|cut -d"-" -f2|grep -v "^lo"|cut -d"*" -f1`
249
	IF_INTERFACES=`ls ifcfg-*|cut -d"-" -f2|grep -v "^lo"|cut -d"*" -f1`
248
	for i in $IF_INTERFACES
250
	for i in $IF_INTERFACES
249
	do
251
	do
250
		IP_INTERFACE=`/usr/sbin/ip link|grep $i`
252
		if [ $(/usr/sbin/ip link | grep -c " $i:") -eq 0 ]; then
251
		if [ -z "$IP_INTERFACE" ]
-
 
252
		then
-
 
253
			rm -f ifcfg-$i
253
			rm -f ifcfg-$i
254
 
254
 
255
			if [ $Lang == "fr" ]
255
			if [ $Lang == "fr" ]
256
				then echo "Suppression : ifcfg-$i"
256
				then echo "Suppression : ifcfg-$i"
257
				else echo "Deleting : ifcfg-$i"
257
				else echo "Deleting: ifcfg-$i"
258
			fi
258
			fi
259
		fi
259
		fi
260
	done
260
	done
261
	cd $DIR_INSTALL
261
	cd $DIR_INSTALL
262
	echo -n "."
262
	echo -n "."