1
|
#!/bin/sh
|
2
|
#
|
3
|
# Usage : check.sh : Test all sites in current directory
|
4
|
# check.sh list_of_sites : Test the sites whose name is given on the command line
|
5
|
|
6
|
exclude_sites="linuxfr listes_libre_entreprise egroupware"
|
7
|
|
8
|
if [ $# -eq 0 ];
|
9
|
then
|
10
|
# Test all sites
|
11
|
for site in *;
|
12
|
do
|
13
|
test_site=1
|
14
|
for exclude_site in $exclude_sites;
|
15
|
do
|
16
|
if [ $site = $exclude_site ];
|
17
|
then
|
18
|
test_site=0
|
19
|
fi
|
20
|
done
|
21
|
if [ $test_site -eq 1 ];
|
22
|
then
|
23
|
sites="$sites $site"
|
24
|
fi
|
25
|
done
|
26
|
else
|
27
|
# Test the sites whose name is given on the command line
|
28
|
while [ $# -ne 0 ];
|
29
|
do
|
30
|
sites="$sites $1"
|
31
|
shift
|
32
|
done
|
33
|
fi
|
34
|
|
35
|
function check() {
|
36
|
site="$1"
|
37
|
files=""
|
38
|
|
39
|
# Combine as many functionnalities as given, at the same time
|
40
|
shift
|
41
|
echo -n " "
|
42
|
while [ $# -ne 0 ];
|
43
|
do
|
44
|
functionnality="$1"
|
45
|
echo -n "$functionnality "
|
46
|
case "$functionnality" in
|
47
|
"Federation")
|
48
|
add_files="sso idp_login federation $site/sso_check";;
|
49
|
"SSO")
|
50
|
add_files="sso idp_login $site/sso_check";;
|
51
|
"SLO")
|
52
|
add_files="slo $site/slo_check";;
|
53
|
esac
|
54
|
files="$files $add_files"
|
55
|
shift
|
56
|
done
|
57
|
echo -n "..."
|
58
|
|
59
|
cat $site/config $files | twill-sh > twill_output
|
60
|
grep "ERROR" twill_output &> /dev/null
|
61
|
if [ $? -eq 0 ];
|
62
|
then
|
63
|
echo " [FAILED]"
|
64
|
cat twill_output
|
65
|
exit 1
|
66
|
else
|
67
|
echo " [OK]"
|
68
|
fi
|
69
|
}
|
70
|
|
71
|
echo
|
72
|
# Check loop
|
73
|
for site in $sites;
|
74
|
do
|
75
|
if [ ! -d $site ];
|
76
|
then
|
77
|
continue
|
78
|
fi
|
79
|
|
80
|
echo "Testing $site :"
|
81
|
|
82
|
echo -n " Defederation ..."
|
83
|
cat $site/config defederation idp_login | twill-sh &> /dev/null
|
84
|
echo " [OK]"
|
85
|
check $site "Federation"
|
86
|
check $site "SSO"
|
87
|
check $site "SLO"
|
88
|
check $site "SSO" "SLO"
|
89
|
check $site "SLO" "SSO" "SLO" "SLO" "SSO" "SLO"
|
90
|
|
91
|
rm -f twill_output
|
92
|
echo
|
93
|
done
|