Subversion Repositories ALCASAR

Rev

Rev 2931 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2931 Rev 2934
1
#!/bin/bash
1
#!/bin/bash
2
 
2
 
3
# alcasar-wifi4eu.sh
3
# alcasar-wifi4eu.sh
4
# by Rexy
4
# by Rexy
5
# This script is distributed under the Gnu General Public License (GPL)
5
# This script is distributed under the Gnu General Public License (GPL)
6
 
6
 
7
# active ou désactive l'affichage du logo WIFI4EU (+ intégration de leur échantillon de code)
7
# active ou désactive l'affichage du logo WIFI4EU (+ intégration de leur échantillon de code)
8
# enable or disable the display of WIFI4EU logo (+ integration of their snippet)
8
# enable or disable the display of WIFI4EU logo (+ integration of their snippet)
9
 
9
 
10
SED="/bin/sed -i"
10
SED="/bin/sed -i"
11
CONF_FILE="/usr/local/etc/alcasar.conf"
11
CONF_FILE="/usr/local/etc/alcasar.conf"
-
 
12
TRUST_SITES_FILE='/usr/local/etc/alcasar-uamdomain'
-
 
13
TRUST_DOMAIN='collection.wifi4eu.ec.europa.eu' # the web site where the snippet connects to
12
HOSTNAME=$(grep ^HOSTNAME= $CONF_FILE | cut -d'=' -f2)
14
HOSTNAME=$(grep ^HOSTNAME= $CONF_FILE | cut -d'=' -f2)
13
DOMAIN=$(grep ^DOMAIN= $CONF_FILE | cut -d'=' -f2)
15
DOMAIN=$(grep ^DOMAIN= $CONF_FILE | cut -d'=' -f2)
14
 
16
 
15
usage="Usage: alcasar-wifi4eu.sh {--on | -on} | {--off | -off}"
17
usage="Usage: alcasar-wifi4eu.sh {--on | -on} | {--off | -off}"
16
nb_args=$#
18
nb_args=$#
17
args=$1
19
args=$1
18
if [ $nb_args -eq 0 ]
20
if [ $nb_args -eq 0 ]
19
then
21
then
20
	echo "$usage"
22
	echo "$usage"
21
	exit 1
23
	exit 1
22
fi
24
fi
23
 
25
 
24
case $args in
26
case $args in
25
	-\? | -h* | --h*)
27
	-\? | -h* | --h*)
26
		echo "$usage"
28
		echo "$usage"
27
		exit 0
29
		exit 0
28
		;;
30
		;;
29
	--off | -off)
31
	--off | -off)
30
		$SED "s?^WIFI4EU=.*?WIFI4EU=off?" $CONF_FILE
32
		$SED "s?^WIFI4EU=.*?WIFI4EU=off?" $CONF_FILE
-
 
33
		$SED "/$TRUST_DOMAIN/d" $TRUST_SITES_FILE
-
 
34
		/usr/local/bin/alcasar-file-clean.sh # Clean & sort conf files.
-
 
35
		/usr/bin/systemctl restart chilli
31
		;;
36
		;;
32
	--on | -on)
37
	--on | -on)
33
		$SED "s?^WIFI4EU=.*?WIFI4EU=on?" $CONF_FILE
38
		$SED "s?^WIFI4EU=.*?WIFI4EU=on?" $CONF_FILE
-
 
39
		echo "uamdomain=\"$TRUST_DOMAIN\"" >> $TRUST_SITES_FILE
-
 
40
		/usr/local/bin/alcasar-file-clean.sh # Clean & sort conf files.
-
 
41
		/usr/bin/systemctl restart chilli
34
		;;
42
		;;
35
	*)
43
	*)
36
		echo "Argument inconnu : $1"
44
		echo "Argument inconnu : $1"
37
		echo "$usage"
45
		echo "$usage"
38
		exit 1
46
		exit 1
39
		;;
47
		;;
40
esac
48
esac
41
 
49