Subversion Repositories ALCASAR

Rev

Rev 2931 | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
2931 rexy 1
#!/bin/bash
2
 
3
# alcasar-wifi4eu.sh
4
# by Rexy
5
# This script is distributed under the Gnu General Public License (GPL)
6
 
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)
9
 
10
SED="/bin/sed -i"
11
CONF_FILE="/usr/local/etc/alcasar.conf"
2934 rexy 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
2931 rexy 14
HOSTNAME=$(grep ^HOSTNAME= $CONF_FILE | cut -d'=' -f2)
15
DOMAIN=$(grep ^DOMAIN= $CONF_FILE | cut -d'=' -f2)
16
 
17
usage="Usage: alcasar-wifi4eu.sh {--on | -on} | {--off | -off}"
18
nb_args=$#
19
args=$1
20
if [ $nb_args -eq 0 ]
21
then
22
	echo "$usage"
23
	exit 1
24
fi
25
 
26
case $args in
27
	-\? | -h* | --h*)
28
		echo "$usage"
29
		exit 0
30
		;;
31
	--off | -off)
32
		$SED "s?^WIFI4EU=.*?WIFI4EU=off?" $CONF_FILE
2934 rexy 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
2931 rexy 36
		;;
37
	--on | -on)
38
		$SED "s?^WIFI4EU=.*?WIFI4EU=on?" $CONF_FILE
2934 rexy 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
2931 rexy 42
		;;
43
	*)
44
		echo "Argument inconnu : $1"
45
		echo "$usage"
46
		exit 1
47
		;;
48
esac