Line 1... |
Line 1... |
1 |
#!/bin/sh
|
1 |
#!/bin/sh
|
2 |
# $Id: alcasar.sh 595 2011-05-04 21:51:30Z richard $
|
2 |
# $Id: alcasar.sh 597 2011-05-05 21:03:57Z richard $
|
3 |
|
3 |
|
4 |
# alcasar.sh
|
4 |
# alcasar.sh
|
5 |
# by Franck BOUIJOUX, Pascal LEVANT and Richard REY
|
5 |
# by Franck BOUIJOUX, Pascal LEVANT and Richard REY
|
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 |
|
7 |
|
Line 58... |
Line 58... |
58 |
# ******* Network parameters - paramètres réseau *******
|
58 |
# ******* Network parameters - paramètres réseau *******
|
59 |
HOSTNAME="alcasar" #
|
59 |
HOSTNAME="alcasar" #
|
60 |
DOMAIN="localdomain" # domaine local
|
60 |
DOMAIN="localdomain" # domaine local
|
61 |
EXTIF="eth0" # ETH0 est l'interface connectée à Internet (Box FAI)
|
61 |
EXTIF="eth0" # ETH0 est l'interface connectée à Internet (Box FAI)
|
62 |
INTIF="eth1" # ETH1 est l'interface connectée au réseau local de consultation
|
62 |
INTIF="eth1" # ETH1 est l'interface connectée au réseau local de consultation
|
63 |
DEFAULT_PRIVATE_NETWORK_MASK="192.168.182.0/24" # adresse du réseau de consultation proposée par défaut
|
63 |
DEFAULT_PRIVATE_IP_MASK="192.168.182.1/24" # adresse d'ALCASAR (+masque) proposée par défaut sur le réseau de consultation
|
64 |
# ****** Paths - chemin des commandes *******
|
64 |
# ****** Paths - chemin des commandes *******
|
65 |
SED="/bin/sed -i"
|
65 |
SED="/bin/sed -i"
|
66 |
# ****************** End of global parameters *********************
|
66 |
# ****************** End of global parameters *********************
|
67 |
|
67 |
|
68 |
header_install ()
|
68 |
header_install ()
|
Line 191... |
Line 191... |
191 |
init ()
|
191 |
init ()
|
192 |
{
|
192 |
{
|
193 |
if [ "$mode" != "update" ]
|
193 |
if [ "$mode" != "update" ]
|
194 |
then
|
194 |
then
|
195 |
# On affecte le nom d'organisme
|
195 |
# On affecte le nom d'organisme
|
- |
|
196 |
header_install
|
196 |
ORGANISME=!
|
197 |
ORGANISME=!
|
197 |
PTN='^[a-zA-Z0-9-]*$'
|
198 |
PTN='^[a-zA-Z0-9-]*$'
|
198 |
until [[ $(expr $ORGANISME : $PTN) -gt 0 ]]
|
199 |
until [[ $(expr $ORGANISME : $PTN) -gt 0 ]]
|
199 |
do
|
200 |
do
|
200 |
if [ $Lang == "fr" ]
|
201 |
if [ $Lang == "fr" ]
|
201 |
then echo "Entrez le nom de votre organisme : "
|
202 |
then echo -n "Entrez le nom de votre organisme : "
|
202 |
else echo -n "Enter the name of your organisation : "
|
203 |
else echo -n "Enter the name of your organism : "
|
203 |
fi
|
204 |
fi
|
204 |
read ORGANISME
|
205 |
read ORGANISME
|
205 |
if [ "$ORGANISME" = "" ]
|
206 |
if [ "$ORGANISME" = "" ]
|
206 |
then
|
207 |
then
|
207 |
ORGANISME=!
|
208 |
ORGANISME=!
|
Line 242... |
Line 243... |
242 |
$SED "s?^radiuspwd=.*?radiuspwd=\"$radiuspwd\"?g" $DIR_DEST_SBIN/alcasar-mysql.sh $DIR_DEST_BIN/alcasar-conf.sh
|
243 |
$SED "s?^radiuspwd=.*?radiuspwd=\"$radiuspwd\"?g" $DIR_DEST_SBIN/alcasar-mysql.sh $DIR_DEST_BIN/alcasar-conf.sh
|
243 |
# On génère le début du fichier récapitulatif
|
244 |
# On génère le début du fichier récapitulatif
|
244 |
cat <<EOF > $FIC_PARAM
|
245 |
cat <<EOF > $FIC_PARAM
|
245 |
################################################
|
246 |
################################################
|
246 |
## ##
|
247 |
## ##
|
247 |
## ALCASAR Paramèters ##
|
248 |
## ALCASAR Parameters ##
|
248 |
## ##
|
249 |
## ##
|
249 |
################################################
|
250 |
################################################
|
250 |
|
251 |
|
251 |
- Install date : $DATE
|
252 |
- Install date : $DATE
|
252 |
- Version : $VERSION
|
253 |
- Version : $VERSION
|
Line 266... |
Line 267... |
266 |
##################################################################
|
267 |
##################################################################
|
267 |
network ()
|
268 |
network ()
|
268 |
{
|
269 |
{
|
269 |
header_install
|
270 |
header_install
|
270 |
if [ $Lang == "fr" ]
|
271 |
if [ $Lang == "fr" ]
|
271 |
then echo "Par défaut, le plan d'adressage IP du réseau de consultation est : $DEFAULT_PRIVATE_NETWORK_MASK"
|
272 |
then echo "Par défaut, l'adresse IP d'ALCASAR sur le réseau de consultation est : $DEFAULT_PRIVATE_IP_MASK"
|
272 |
else echo "The default consultation network IP address is : $DEFAULT_PRIVATE_NETWORK_MASK"
|
273 |
else echo "The default ALCASAR IP address on consultation network is : $DEFAULT_PRIVATE_IP_MASK"
|
273 |
fi
|
274 |
fi
|
274 |
response=0
|
275 |
response=0
|
275 |
PTN='^[oOyYnN]$'
|
276 |
PTN='^[oOyYnN]$'
|
276 |
until [[ $(expr $response : $PTN) -gt 0 ]]
|
277 |
until [[ $(expr $response : $PTN) -gt 0 ]]
|
277 |
do
|
278 |
do
|
Line 281... |
Line 282... |
281 |
fi
|
282 |
fi
|
282 |
read response
|
283 |
read response
|
283 |
done
|
284 |
done
|
284 |
if [ "$response" = "n" ] || [ "$response" = "N" ]
|
285 |
if [ "$response" = "n" ] || [ "$response" = "N" ]
|
285 |
then
|
286 |
then
|
286 |
PRIVATE_NETWORK_MASK="0"
|
287 |
PRIVATE_IP_MASK="0"
|
287 |
PTN='^\([01]\?[[:digit:]][[:digit:]]\?\|2[0-4][[:digit:]]\|25[0-5]\).\([01]\?[[:digit:]][[:digit:]]\?\|2[0-4][[:digit:]]\|25[0-5]\).\([01]\?[[:digit:]][[:digit:]]\?\|2[0-4][[:digit:]]\|25[0-5]\).\([01]\?[[:digit:]][[:digit:]]\?\|2[0-4][[:digit:]]\|25[0-5]\)/[012]\?[[:digit:]]$'
|
288 |
PTN='^\([01]\?[[:digit:]][[:digit:]]\?\|2[0-4][[:digit:]]\|25[0-5]\).\([01]\?[[:digit:]][[:digit:]]\?\|2[0-4][[:digit:]]\|25[0-5]\).\([01]\?[[:digit:]][[:digit:]]\?\|2[0-4][[:digit:]]\|25[0-5]\).\([01]\?[[:digit:]][[:digit:]]\?\|2[0-4][[:digit:]]\|25[0-5]\)/[012]\?[[:digit:]]$'
|
288 |
until [[ $(expr $PRIVATE_NETWORK_MASK : $PTN) -gt 0 ]]
|
289 |
until [[ $(expr $PRIVATE_IP_MASK : $PTN) -gt 0 ]]
|
289 |
do
|
290 |
do
|
290 |
if [ $Lang == "fr" ]
|
291 |
if [ $Lang == "fr" ]
|
291 |
then echo -n "Entrez un plan d'adressage IP au format CIDR (a.b.c.d/xx) : "
|
292 |
then echo -n "Entrez l'adresse IP d'ALCASAR au format CIDR (a.b.c.d/xx) : "
|
292 |
else echo -n "Enter a network IP address in CIDR format (a.b.c.d/xx) : "
|
293 |
else echo -n "Enter ALCASAR IP address in CIDR format (a.b.c.d/xx) : "
|
293 |
fi
|
294 |
fi
|
294 |
read PRIVATE_NETWORK_MASK
|
295 |
read PRIVATE_IP_MASK
|
295 |
|
296 |
|
296 |
done
|
297 |
done
|
297 |
else
|
298 |
else
|
298 |
PRIVATE_NETWORK_MASK=$DEFAULT_PRIVATE_NETWORK_MASK
|
299 |
PRIVATE_IP_MASK=$DEFAULT_PRIVATE_IP_MASK
|
299 |
fi
|
300 |
fi
|
300 |
# Définition de la config réseau côté "LAN de consultation"
|
301 |
# Définition de la config réseau côté "LAN de consultation"
|
301 |
hostname $HOSTNAME
|
302 |
hostname $HOSTNAME
|
302 |
echo "- Hostname : $HOSTNAME" >> $FIC_PARAM
|
303 |
echo "- Hostname : $HOSTNAME" >> $FIC_PARAM
|
303 |
PRIVATE_NETWORK=`/bin/ipcalc -n $DEFAULT_PRIVATE_NETWORK_MASK | cut -d"=" -f2` # @ réseau de consultation (ex.: 192.168.182.0)
|
304 |
PRIVATE_NETWORK=`/bin/ipcalc -n $PRIVATE_IP_MASK | cut -d"=" -f2` # @ réseau de consultation (ex.: 192.168.182.0)
|
304 |
PRIVATE_PREFIX=`/bin/ipcalc -p $DEFAULT_PRIVATE_NETWORK_MASK |cut -d"=" -f2` # prefixe du réseau (ex. 24)
|
305 |
private_prefix=`/bin/ipcalc -p $PRIVATE_IP_MASK |cut -d"=" -f2` # prefixe du réseau (ex. 24)
|
305 |
PRIVATE_NETWORK_MASK=$PRIVATE_NETWORK/$PRIVATE_PREFIX # @ réseau + masque (x.0.0.0/8 ou x.y.0.0/16 ou x.y.z.0/24)
|
306 |
PRIVATE_NETWORK_MASK=$PRIVATE_NETWORK/$private_prefix # @ + masque du réseau de consult (192.168.182.0/24)
|
306 |
classe=$((PRIVATE_PREFIX/8)); # classe de réseau (ex.: 2=classe B, 3=classe C)
|
307 |
classe=$((private_prefix/8)); # classe de réseau (ex.: 2=classe B, 3=classe C)
|
307 |
classe_sup=`expr $classe + 1`
|
308 |
classe_sup=`expr $classe + 1`
|
308 |
private_network_ending=`echo $PRIVATE_NETWORK | cut -d"." -f$classe_sup`
|
309 |
private_network_ending=`echo $PRIVATE_NETWORK | cut -d"." -f$classe_sup` # dernier octet de l'@ de réseau
|
309 |
PRIVATE_NETWORK_SHORT=`echo $PRIVATE_NETWORK | cut -d"." -f1-$classe`. # @ compatible hosts.allow et hosts.deny (ex.: 192.168.182.)
|
310 |
PRIVATE_NETWORK_SHORT=`echo $PRIVATE_NETWORK | cut -d"." -f1-$classe`. # @ compatible hosts.allow et hosts.deny (ex.: 192.168.182.)
|
310 |
PRIVATE_MASK=`/bin/ipcalc -m $PRIVATE_NETWORK_MASK | cut -d"=" -f2` # masque réseau de consultation (ex.: 255.255.255.0)
|
311 |
PRIVATE_MASK=`/bin/ipcalc -m $PRIVATE_IP_MASK | cut -d"=" -f2` # masque réseau de consultation (ex.: 255.255.255.0)
|
311 |
PRIVATE_BROADCAST=`/bin/ipcalc -b $PRIVATE_NETWORK_MASK | cut -d"=" -f2` # @ broadcast réseau de consultation (ex.: 192.168.182.255)
|
312 |
PRIVATE_BROADCAST=`/bin/ipcalc -b $PRIVATE_IP_MASK | cut -d"=" -f2` # @ broadcast réseau de consultation (ex.: 192.168.182.255)
|
- |
|
313 |
private_broadcast_ending=`echo $PRIVATE_BROADCAST | cut -d"." -f$classe_sup` # dernier octet de l'@ de broadcast
|
312 |
PRIVATE_IP=`echo $PRIVATE_NETWORK | cut -d"." -f1-3`"."`expr $private_network_ending + 1` # @ip du portail (côté réseau de consultation)
|
314 |
PRIVATE_IP=`echo $PRIVATE_IP_MASK | cut -d"/" -f1` # @ip du portail (côté réseau de consultation)
|
313 |
PRIVATE_DYN_FIRST_IP=`echo $PRIVATE_IP | cut -d"." -f1-3`"."`expr $private_network_ending + 1` # @ip du portail (côté réseau de consultation)
|
315 |
PRIVATE_DYN_FIRST_IP=`echo $PRIVATE_NETWORK | cut -d"." -f1-3`"."`expr $private_network_ending + 2` # @ip du portail (côté réseau de consultation)
|
314 |
PRIVATE_DYN_LAST_IP=`echo $PRIVATE_BROADCAST | cut -d"." -f1-3`"."`expr $private_network_ending - 1` # @ip du portail (côté réseau de consultation)
|
316 |
PRIVATE_DYN_LAST_IP=`echo $PRIVATE_BROADCAST | cut -d"." -f1-3`"."`expr $private_broadcast_ending - 1` # @ip du portail (côté réseau de consultation)
|
315 |
# Récupération de la config réseau côté "Internet"
|
317 |
# Récupération de la config réseau côté "Internet"
|
316 |
[ -e /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF ] || cp /etc/sysconfig/network-scripts/ifcfg-$EXTIF /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF
|
318 |
[ -e /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF ] || cp /etc/sysconfig/network-scripts/ifcfg-$EXTIF /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF
|
317 |
EXT_IP=`grep IPADDR /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF|cut -d"=" -f2` # @ip du portail (côté Internet)
|
319 |
PUBLIC_IP=`grep IPADDR /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF|cut -d"=" -f2` # @ip du portail (côté Internet)
|
318 |
[ -e /etc/sysconfig/network.default ] || cp /etc/sysconfig/network /etc/sysconfig/network.default
|
- |
|
319 |
DNS1=`grep DNS1 /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF|cut -d"=" -f2` # @ip 1er DNS
|
320 |
DNS1=`grep DNS1 /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF|cut -d"=" -f2` # @ip 1er DNS
|
320 |
DNS2=`grep DNS2 /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF|cut -d"=" -f2` # @ip 2ème DNS
|
321 |
DNS2=`grep DNS2 /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF|cut -d"=" -f2` # @ip 2ème DNS
|
321 |
DNS1=${DNS1:=208.67.220.220}
|
322 |
DNS1=${DNS1:=208.67.220.220}
|
322 |
DNS2=${DNS2:=208.67.222.222}
|
323 |
DNS2=${DNS2:=208.67.222.222}
|
323 |
EXT_NETMASK=`grep NETMASK /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF|cut -d"=" -f2`
|
324 |
PUBLIC_NETMASK=`grep NETMASK /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF|cut -d"=" -f2`
|
- |
|
325 |
PUBLIC_PREFIX=`/bin/ipcalc -p $PUBLIC_IP $PUBLIC_NETMASK |cut -d"=" -f2` # prefixe du réseau (ex. 24)
|
324 |
EXT_GATEWAY=`grep GATEWAY /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF|cut -d"=" -f2`
|
326 |
PUBLIC_GATEWAY=`grep GATEWAY /etc/sysconfig/network-scripts/default-ifcfg-$EXTIF|cut -d"=" -f2`
|
325 |
echo "- IP address 'Internet side' ($EXTIF) : $EXT_IP / $EXT_NETMASK" >> $FIC_PARAM
|
327 |
echo "- WAN IP address ($EXTIF) :\t$PUBLIC_IP/$PUBLIC_PREFIX" >> $FIC_PARAM
|
326 |
echo "- Gateway : $EXT_GATEWAY" >> $FIC_PARAM
|
328 |
echo "- Gateway IP address :\t$PUBLIC_GATEWAY" >> $FIC_PARAM
|
327 |
echo "- DNS servers : $DNS1 et $DNS2" >> $FIC_PARAM
|
329 |
echo "- DNS servers :\t$DNS1 and $DNS2" >> $FIC_PARAM
|
328 |
echo "- IP address 'LAN side' ($INTIF) : $PRIVATE_IP/$PRIVATE_PREFIX" >> $FIC_PARAM
|
330 |
echo "- LAN IP address ($INTIF) :\t$PRIVATE_IP_MASK" >> $FIC_PARAM
|
329 |
echo "- Dynamic IP addresses (DHCP) : from $PRIVATE_DYN_FIRST_IP to $PRIVATE_DYN_LAST_IP" >> $FIC_PARAM
|
331 |
echo "- Dynamic IP addresses (DHCP) :\tfrom $PRIVATE_DYN_FIRST_IP to $PRIVATE_DYN_LAST_IP" >> $FIC_PARAM
|
- |
|
332 |
echo "#### ALCASAR Network parameters ####" > $DIR_DEST_ETC/alcasar-network
|
- |
|
333 |
echo "# Lauch the script 'alcasar-network.sh' after your changes" >> $DIR_DEST_ETC/alcasar-network
|
- |
|
334 |
echo "# Lancez le script 'alcasar-network.sh' après vos modifications" >> $DIR_DEST_ETC/alcasar-network
|
330 |
echo "PRIVATE_NETWORK_MASK=$PRIVATE_NETWORK_MASK" > $DIR_DEST_ETC/alcasar-network
|
335 |
echo "PUBLIC_IP=$PUBLIC_IP/$PUBLIC_PREFIX" >> $DIR_DEST_ETC/alcasar-network
|
- |
|
336 |
echo "GW=$PUBLIC_GATEWAY" >> $DIR_DEST_ETC/alcasar-network
|
- |
|
337 |
echo "DNS1=$DNS1" >> $DIR_DEST_ETC/alcasar-network
|
- |
|
338 |
echo "DNS2=$DNS2" >> $DIR_DEST_ETC/alcasar-network
|
331 |
echo "PRIVATE_IP=$PRIVATE_IP" >> $DIR_DEST_ETC/alcasar-network
|
339 |
echo "PRIVATE_IP=$PRIVATE_IP_MASK" >> $DIR_DEST_ETC/alcasar-network
|
332 |
echo "DHCP=on" >> $DIR_DEST_ETC/alcasar-network
|
340 |
echo "DHCP=on" >> $DIR_DEST_ETC/alcasar-network
|
- |
|
341 |
echo "DHCP_FIRST=$PRIVATE_DYN_FIRST_IP" >> $DIR_DEST_ETC/alcasar-network
|
- |
|
342 |
echo "DHCP_LAST=$PRIVATE_DYN_LAST_IP" >> $DIR_DEST_ETC/alcasar-network
|
- |
|
343 |
[ -e /etc/sysconfig/network.default ] || cp /etc/sysconfig/network /etc/sysconfig/network.default
|
333 |
# Configuration réseau
|
344 |
# Configuration réseau
|
334 |
cat <<EOF > /etc/sysconfig/network
|
345 |
cat <<EOF > /etc/sysconfig/network
|
335 |
NETWORKING=yes
|
346 |
NETWORKING=yes
|
336 |
HOSTNAME="$HOSTNAME"
|
347 |
HOSTNAME="$HOSTNAME"
|
337 |
FORWARD_IPV4=true
|
348 |
FORWARD_IPV4=true
|
Line 344... |
Line 355... |
344 |
EOF
|
355 |
EOF
|
345 |
# Configuration de l'interface eth0 (Internet)
|
356 |
# Configuration de l'interface eth0 (Internet)
|
346 |
cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-$EXTIF
|
357 |
cat <<EOF > /etc/sysconfig/network-scripts/ifcfg-$EXTIF
|
347 |
DEVICE=$EXTIF
|
358 |
DEVICE=$EXTIF
|
348 |
BOOTPROTO=static
|
359 |
BOOTPROTO=static
|
349 |
IPADDR=$EXT_IP
|
360 |
IPADDR=$PUBLIC_IP
|
350 |
NETMASK=$EXT_NETMASK
|
361 |
NETMASK=$PUBLIC_NETMASK
|
351 |
GATEWAY=$EXT_GATEWAY
|
362 |
GATEWAY=$PUBLIC_GATEWAY
|
352 |
DNS1=127.0.0.1
|
363 |
DNS1=127.0.0.1
|
353 |
ONBOOT=yes
|
364 |
ONBOOT=yes
|
354 |
METRIC=10
|
365 |
METRIC=10
|
355 |
NOZEROCONF=yes
|
366 |
NOZEROCONF=yes
|
356 |
MII_NOT_SUPPORTED=yes
|
367 |
MII_NOT_SUPPORTED=yes
|
Line 815... |
Line 826... |
815 |
echo -e "uamallowed=\"\"" > $DIR_DEST_ETC/alcasar-uamallowed
|
826 |
echo -e "uamallowed=\"\"" > $DIR_DEST_ETC/alcasar-uamallowed
|
816 |
echo -e "uamdomain=\"\"" > $DIR_DEST_ETC/alcasar-uamdomain
|
827 |
echo -e "uamdomain=\"\"" > $DIR_DEST_ETC/alcasar-uamdomain
|
817 |
touch $DIR_DEST_ETC/alcasar-macallowed
|
828 |
touch $DIR_DEST_ETC/alcasar-macallowed
|
818 |
chown root:apache $DIR_DEST_ETC/alcasar-*
|
829 |
chown root:apache $DIR_DEST_ETC/alcasar-*
|
819 |
chmod 660 $DIR_DEST_ETC/alcasar-*
|
830 |
chmod 660 $DIR_DEST_ETC/alcasar-*
|
820 |
echo "- Disconnect URL : http://alcasar:3990/logoff" >> $FIC_PARAM
|
831 |
echo "- User disconnect URL : http://alcasar:3990/logoff" >> $FIC_PARAM
|
821 |
# Configuration des fichier WEB d'interception (secret partagé avec coova-chilli et nom d'organisme)
|
832 |
# Configuration des fichier WEB d'interception (secret partagé avec coova-chilli et nom d'organisme)
|
822 |
$SED "s?^\$uamsecret =.*?\$uamsecret = \"$secretuam\";?g" $DIR_WEB/intercept.php
|
833 |
$SED "s?^\$uamsecret =.*?\$uamsecret = \"$secretuam\";?g" $DIR_WEB/intercept.php
|
823 |
$SED "s?^\$userpassword=1.*?\$userpassword=1;?g" $DIR_WEB/intercept.php
|
834 |
$SED "s?^\$userpassword=1.*?\$userpassword=1;?g" $DIR_WEB/intercept.php
|
824 |
$SED "s?^\$organisme = .*?\$organisme = \"$ORGANISME\";?g" $DIR_WEB/intercept.php $DIR_WEB/status.php
|
835 |
$SED "s?^\$organisme = .*?\$organisme = \"$ORGANISME\";?g" $DIR_WEB/intercept.php $DIR_WEB/status.php
|
825 |
} # End of param_chilli ()
|
836 |
} # End of param_chilli ()
|
Line 1371... |
Line 1382... |
1371 |
if [ "$user" == "$rm_users" ]
|
1382 |
if [ "$user" == "$rm_users" ]
|
1372 |
then
|
1383 |
then
|
1373 |
/usr/sbin/userdel -f $rm_users
|
1384 |
/usr/sbin/userdel -f $rm_users
|
1374 |
fi
|
1385 |
fi
|
1375 |
done
|
1386 |
done
|
1376 |
# dans le cas d'une mise à jour, on charge la conf d'une version précédente
|
1387 |
# Load the previous conf file
|
1377 |
if [ "$mode" = "update" ]
|
1388 |
if [ "$mode" = "update" ]
|
1378 |
then
|
1389 |
then
|
1379 |
$DIR_DEST_BIN/alcasar-conf.sh --load
|
1390 |
$DIR_DEST_BIN/alcasar-conf.sh --load
|
1380 |
fi
|
1391 |
fi
|
1381 |
rm -f /tmp/alcasar-conf*
|
1392 |
rm -f /tmp/alcasar-conf*
|
Line 1425... |
Line 1436... |
1425 |
exit 0
|
1436 |
exit 0
|
1426 |
;;
|
1437 |
;;
|
1427 |
-i | --install)
|
1438 |
-i | --install)
|
1428 |
header_install
|
1439 |
header_install
|
1429 |
testing
|
1440 |
testing
|
1430 |
# On teste la présence d'une version déjà installée
|
1441 |
# Test if ALCASAR is already installed
|
1431 |
if [ -e $DIR_WEB/VERSION ]
|
1442 |
if [ -e $DIR_WEB/VERSION ]
|
1432 |
then
|
1443 |
then
|
1433 |
actual_version=`cat $DIR_WEB/VERSION`
|
1444 |
actual_version=`cat $DIR_WEB/VERSION`
|
1434 |
if [ $Lang == "fr" ]
|
1445 |
if [ $Lang == "fr" ]
|
1435 |
then echo -n "La version "; echo -n $actual_version ; echo " d'ALCASAR est déjà installée";
|
1446 |
then echo -n "La version "; echo -n $actual_version ; echo " d'ALCASAR est déjà installée";
|
Line 1443... |
Line 1454... |
1443 |
then echo -n "Voulez-vous effectuer une mise à jour (O/n)? ";
|
1454 |
then echo -n "Voulez-vous effectuer une mise à jour (O/n)? ";
|
1444 |
else echo -n "Do you want to update (Y/n)?";
|
1455 |
else echo -n "Do you want to update (Y/n)?";
|
1445 |
fi
|
1456 |
fi
|
1446 |
read response
|
1457 |
read response
|
1447 |
done
|
1458 |
done
|
1448 |
if [ "$response" = "o" ] || [ "$response" = "O" ] || [ "$response" = "y" ] || [ "$response" = "Y" ]
|
1459 |
if [ "$response" = "n" ] || [ "$response" = "N" ]
|
1449 |
then
|
1460 |
then
|
- |
|
1461 |
rm -f /tmp/alcasar-conf*
|
- |
|
1462 |
else
|
1450 |
RUNNING_VERSION=`cat $DIR_WEB/VERSION|cut -d" " -f1`
|
1463 |
RUNNING_VERSION=`cat $DIR_WEB/VERSION|cut -d" " -f1`
|
1451 |
MAJ_RUNNING_VERSION=`echo $RUNNING_VERSION|cut -d"." -f1`
|
1464 |
MAJ_RUNNING_VERSION=`echo $RUNNING_VERSION|cut -d"." -f1`
|
1452 |
MIN_RUNNING_VERSION=`echo $RUNNING_VERSION|cut -d"." -f2|cut -c1`
|
1465 |
MIN_RUNNING_VERSION=`echo $RUNNING_VERSION|cut -d"." -f2|cut -c1`
|
1453 |
UPD_RUNNING_VERSION=`echo $RUNNING_VERSION|cut -d"." -f3`
|
1466 |
UPD_RUNNING_VERSION=`echo $RUNNING_VERSION|cut -d"." -f3`
|
1454 |
# On crée le fichier de conf de la version actuelle
|
1467 |
# Create the conf file of the running version
|
1455 |
chmod u+x $DIR_SCRIPTS/alcasar-conf.sh
|
1468 |
chmod u+x $DIR_SCRIPTS/alcasar-conf.sh
|
1456 |
$DIR_SCRIPTS/alcasar-conf.sh --create
|
1469 |
$DIR_SCRIPTS/alcasar-conf.sh --create
|
1457 |
mode="update"
|
1470 |
mode="update"
|
1458 |
fi
|
1471 |
fi
|
1459 |
fi
|
1472 |
fi
|
Line 1463... |
Line 1476... |
1463 |
then
|
1476 |
then
|
1464 |
exit 0
|
1477 |
exit 0
|
1465 |
fi
|
1478 |
fi
|
1466 |
if [ -e $DIR_WEB/VERSION ]
|
1479 |
if [ -e $DIR_WEB/VERSION ]
|
1467 |
then
|
1480 |
then
|
1468 |
# On désinstalle la version actuelle
|
1481 |
# Uninstall the running version
|
1469 |
$DIR_SCRIPTS/sbin/alcasar-uninstall.sh
|
1482 |
$DIR_SCRIPTS/sbin/alcasar-uninstall.sh
|
1470 |
fi
|
1483 |
fi
|
- |
|
1484 |
if [ -e /tmp/alcasar-conf.tar.gz ] && [ "$mode" != "update" ]
|
- |
|
1485 |
then
|
- |
|
1486 |
if [ $Lang == "fr" ]
|
- |
|
1487 |
then echo -n "Le fichier de configuration d'une ancienne version a été trouvé";
|
- |
|
1488 |
else echo -n "The configuration file of an old version has been found";
|
- |
|
1489 |
fi
|
- |
|
1490 |
response=0
|
- |
|
1491 |
PTN='^[oOnNyY]$'
|
- |
|
1492 |
until [[ $(expr $response : $PTN) -gt 0 ]]
|
- |
|
1493 |
do
|
- |
|
1494 |
if [ $Lang == "fr" ]
|
- |
|
1495 |
then echo -n "Voulez-vous l'utiliser (O/n)? ";
|
- |
|
1496 |
else echo -n "Do you want to use it (Y/n)?";
|
- |
|
1497 |
fi
|
- |
|
1498 |
read response
|
- |
|
1499 |
if [ "$response" = "n" ] || [ "$response" = "N" ]
|
- |
|
1500 |
then rm -f /tmp/alcasar-conf*
|
- |
|
1501 |
fi
|
- |
|
1502 |
done
|
- |
|
1503 |
fi
|
1471 |
if [ -e /tmp/alcasar-conf.tar.gz ]
|
1504 |
if [ -e /tmp/alcasar-conf.tar.gz ]
|
1472 |
then
|
1505 |
then
|
1473 |
if [ $Lang == "fr" ]
|
1506 |
if [ $Lang == "fr" ]
|
1474 |
then echo "#### Installation avec mise à jour ####"
|
1507 |
then echo "#### Installation avec mise à jour ####";
|
1475 |
else echo "#### Installation with update ####"
|
1508 |
else echo "#### Installation with update ####";
|
1476 |
fi
|
1509 |
fi
|
1477 |
# On récupère le nom d'organisme à partir de fichier de conf
|
1510 |
# Read the organism name from the conf file
|
1478 |
tar -xvf /tmp/alcasar-conf.tar.gz conf/organisme
|
1511 |
tar -xvf /tmp/alcasar-conf.tar.gz conf/organisme
|
1479 |
ORGANISME=`cat $DIR_CONF/organisme`
|
1512 |
ORGANISME=`cat $DIR_CONF/organisme`
|
1480 |
mode="update"
|
1513 |
mode="update"
|
1481 |
else
|
1514 |
else
|
1482 |
mode="install"
|
1515 |
mode="install"
|
1483 |
fi
|
1516 |
fi
|
1484 |
for func in init network gestion AC init_db param_radius param_web_radius param_chilli param_squid param_dansguardian antivirus firewall param_ulogd param_awstats param_dnsmasq BL cron post_install
|
1517 |
for func in init network gestion AC init_db param_radius param_web_radius param_chilli param_squid param_dansguardian antivirus firewall param_ulogd param_awstats param_dnsmasq BL cron post_install
|
1485 |
|
- |
|
1486 |
do
|
1518 |
do
|
1487 |
$func
|
1519 |
$func
|
1488 |
echo "*** 'debug' : end of function $func ***"; read a
|
1520 |
echo "*** 'debug' : end of function $func ***"; read a
|
1489 |
done
|
1521 |
done
|
1490 |
;;
|
1522 |
;;
|
1491 |
-u | --uninstall)
|
1523 |
-u | --uninstall)
|
1492 |
if [ ! -e $DIR_DEST_SBIN/alcasar-uninstall.sh ]
|
1524 |
if [ ! -e $DIR_DEST_SBIN/alcasar-uninstall.sh ]
|
1493 |
then
|
1525 |
then
|
- |
|
1526 |
if [ $Lang == "fr" ]
|
1494 |
echo "Aucune version d'ALCASAR n'a été trouvée.";
|
1527 |
then echo "ALCASAR n'est pas installé!";
|
- |
|
1528 |
else echo "ALCASAR isn't installed!";
|
- |
|
1529 |
fi
|
1495 |
exit 0
|
1530 |
exit 0
|
1496 |
fi
|
1531 |
fi
|
1497 |
response=0
|
1532 |
response=0
|
1498 |
PTN='^[oOnN]$'
|
1533 |
PTN='^[oOnN]$'
|
1499 |
until [[ $(expr $response : $PTN) -gt 0 ]]
|
1534 |
until [[ $(expr $response : $PTN) -gt 0 ]]
|
1500 |
do
|
1535 |
do
|
- |
|
1536 |
if [ $Lang == "fr" ]
|
1501 |
echo -n "Voulez-vous créer le fichier de conf de la version actuelle (0/n)? "
|
1537 |
then echo -n "Voulez-vous créer le fichier de configuration de la version actuelle (0/n)? ";
|
- |
|
1538 |
else echo -n "Do you want to crate the running version configuration file (Y/n)? ";
|
- |
|
1539 |
fi
|
1502 |
read response
|
1540 |
read response
|
1503 |
done
|
1541 |
done
|
1504 |
if [ "$reponse" = "o" ] || [ "$reponse" = "O" ]
|
1542 |
if [ "$reponse" = "o" ] || [ "$reponse" = "O" ] || [ "$response" = "Y" ] || [ "$response" = "y" ]
|
1505 |
then
|
1543 |
then
|
1506 |
$DIR_SCRIPT/alcasar-conf.sh --create
|
1544 |
$DIR_SCRIPT/alcasar-conf.sh --create
|
1507 |
else
|
1545 |
else
|
1508 |
rm -f /tmp/alcasar-conf*
|
1546 |
rm -f /tmp/alcasar-conf*
|
1509 |
fi
|
1547 |
fi
|
1510 |
# On désinstalle la version actuelle
|
1548 |
# Uninstall the running version
|
1511 |
$DIR_SCRIPTS/sbin/alcasar-uninstall.sh
|
1549 |
$DIR_SCRIPTS/sbin/alcasar-uninstall.sh
|
1512 |
;;
|
1550 |
;;
|
1513 |
*)
|
1551 |
*)
|
1514 |
echo "Argument inconnu :$1";
|
1552 |
echo "Argument inconnu :$1";
|
1515 |
echo "Unknown argument :$1";
|
1553 |
echo "Unknown argument :$1";
|