| Line 1... |
Line 1... |
| 1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
| 2 |
# $Id: alcasar.sh 1469 2014-10-30 21:58:47Z richard $
|
2 |
# $Id: alcasar.sh 1471 2014-10-31 17:46:11Z richard $
|
| 3 |
|
3 |
|
| 4 |
# alcasar.sh
|
4 |
# alcasar.sh
|
| 5 |
|
5 |
|
| 6 |
# ALCASAR Install script - CopyLeft ALCASAR Team [Rexy + 3abtux + Steweb + Crox + ...]
|
6 |
# ALCASAR Install script - CopyLeft ALCASAR Team [Rexy + 3abtux + Steweb + Crox + ...]
|
| 7 |
# Ce programme est un logiciel libre ; This software is free and open source
|
7 |
# Ce programme est un logiciel libre ; This software is free and open source
|
| Line 70... |
Line 70... |
| 70 |
DB_USER="radius" # user name allows to request the users database
|
70 |
DB_USER="radius" # user name allows to request the users database
|
| 71 |
DB_GAMMU="gammu" # database name used by Gammu-smsd
|
71 |
DB_GAMMU="gammu" # database name used by Gammu-smsd
|
| 72 |
# ******* Network parameters - paramètres réseau *******
|
72 |
# ******* Network parameters - paramètres réseau *******
|
| 73 |
HOSTNAME="alcasar" # default hostname
|
73 |
HOSTNAME="alcasar" # default hostname
|
| 74 |
DOMAIN="localdomain" # default local domain
|
74 |
DOMAIN="localdomain" # default local domain
|
| 75 |
EXTIF=`/sbin/ip route|grep default|cut -d" " -f5` # EXTIF is connected to the ISP broadband modem/router (In France : Box-FAI)
|
75 |
EXTIF=`/sbin/ip route|grep default|cut -d" " -f5` # EXTIF is connected to the ISP broadband modem/router (In France : Box-FAI)
|
| 76 |
INTIF=`/sbin/ip link|grep '^[[:digit:]]:'|grep -v "lo\|$EXTIF"|cut -d" " -f2|tr -d ":"` # INTIF is connected to the consultation network
|
76 |
INTIF=`/sbin/ip link|grep '^[[:digit:]]:'|grep -v "lo\|$EXTIF"|cut -d" " -f2|tr -d ":"` # INTIF is connected to the consultation network
|
| 77 |
MTU="1500"
|
77 |
MTU="1500"
|
| 78 |
ETHTOOL_OPTS='"autoneg off speed 100 duplex full"'
|
78 |
ETHTOOL_OPTS='"autoneg off speed 100 duplex full"'
|
| 79 |
DEFAULT_PRIVATE_IP_MASK="192.168.182.1/24" # Default ALCASAR IP address
|
79 |
DEFAULT_PRIVATE_IP_MASK="192.168.182.1/24" # Default ALCASAR IP address
|
| 80 |
# ****** Paths - chemin des commandes *******
|
80 |
# ****** Paths - chemin des commandes *******
|
| Line 129... |
Line 129... |
| 129 |
done
|
129 |
done
|
| 130 |
if [ "$response" = "n" ] || [ "$response" = "N" ]
|
130 |
if [ "$response" = "n" ] || [ "$response" = "N" ]
|
| 131 |
then
|
131 |
then
|
| 132 |
rm -f /tmp/alcasar-conf*
|
132 |
rm -f /tmp/alcasar-conf*
|
| 133 |
else
|
133 |
else
|
| 134 |
# Create a backup of running version importants files
|
134 |
# Create a backup of running importants files
|
| 135 |
$DIR_SCRIPTS/alcasar-conf.sh --create
|
135 |
$DIR_SCRIPTS/alcasar-conf.sh --create
|
| 136 |
mode="update"
|
136 |
mode="update"
|
| 137 |
fi
|
137 |
fi
|
| 138 |
else
|
138 |
else
|
| 139 |
if [ ! -d /var/log/netflow/porttracker ]
|
139 |
if [ ! -d /var/log/netflow/porttracker ]
|
| Line 204... |
Line 204... |
| 204 |
fi
|
204 |
fi
|
| 205 |
if [ $Lang == "fr" ]
|
205 |
if [ $Lang == "fr" ]
|
| 206 |
then echo -n "Tests des paramètres réseau : "
|
206 |
then echo -n "Tests des paramètres réseau : "
|
| 207 |
else echo -n "Network parameters tests : "
|
207 |
else echo -n "Network parameters tests : "
|
| 208 |
fi
|
208 |
fi
|
| - |
|
209 |
|
| - |
|
210 |
# Test of Ethernet links state
|
| - |
|
211 |
DOWN_IF=`/sbin/ip link|grep "NO-CARRIER"|cut -d":" -f2|tr -d " "`
|
| - |
|
212 |
for i in $DOWN_IF
|
| - |
|
213 |
do
|
| - |
|
214 |
if [ $Lang == "fr" ]
|
| - |
|
215 |
then
|
| - |
|
216 |
echo "Échec"
|
| - |
|
217 |
echo "Le lien réseau de la carte $i n'est pas actif."
|
| - |
|
218 |
echo "Assurez-vous que cette carte est bien connectée à un équipement (commutateur, A.P., etc.)"
|
| - |
|
219 |
else
|
| - |
|
220 |
echo "Failed"
|
| - |
|
221 |
echo "The link state of $i interface is down."
|
| - |
|
222 |
echo "Make sure that this network card is connected to a switch or an A.P."
|
| - |
|
223 |
fi
|
| - |
|
224 |
exit 0
|
| - |
|
225 |
done
|
| - |
|
226 |
echo -n "."
|
| - |
|
227 |
|
| 209 |
# We test EXTIF config files
|
228 |
# Test EXTIF config files
|
| 210 |
PUBLIC_IP=`grep IPADDR /etc/sysconfig/network-scripts/ifcfg-$EXTIF|cut -d"=" -f2`
|
229 |
PUBLIC_IP=`grep IPADDR /etc/sysconfig/network-scripts/ifcfg-$EXTIF|cut -d"=" -f2`
|
| 211 |
PUBLIC_GATEWAY=`grep GATEWAY /etc/sysconfig/network-scripts/ifcfg-$EXTIF|cut -d"=" -f2`
|
230 |
PUBLIC_GATEWAY=`grep GATEWAY /etc/sysconfig/network-scripts/ifcfg-$EXTIF|cut -d"=" -f2`
|
| 212 |
if [ "$EXTIF" == "" ] || [ `echo $PUBLIC_IP|wc -c` -lt 7 ] || [ `echo $PUBLIC_GATEWAY|wc -c` -lt 7 ]
|
231 |
if [ `echo $PUBLIC_IP|wc -c` -lt 7 ] || [ `echo $PUBLIC_GATEWAY|wc -c` -lt 7 ]
|
| 213 |
then
|
232 |
then
|
| 214 |
if [ $Lang == "fr" ]
|
233 |
if [ $Lang == "fr" ]
|
| 215 |
then
|
234 |
then
|
| 216 |
echo "Échec"
|
235 |
echo "Échec"
|
| 217 |
echo "La carte réseau connectée à Internet ($EXTIF) n'est pas correctement configurée."
|
236 |
echo "La carte réseau connectée à Internet ($EXTIF) n'est pas correctement configurée."
|
| 218 |
echo "Renseignez les champs suivants dans le fichier '/etc/sysconfig/network-scripts/ifcfg-$EXTIF' :"
|
237 |
echo "Renseignez les champs suivants dans le fichier '/etc/sysconfig/network-scripts/ifcfg-$EXTIF' :"
|
| Line 231... |
Line 250... |
| 231 |
echo "DNS2="
|
250 |
echo "DNS2="
|
| 232 |
echo "ONBOOT=yes"
|
251 |
echo "ONBOOT=yes"
|
| 233 |
exit 0
|
252 |
exit 0
|
| 234 |
fi
|
253 |
fi
|
| 235 |
echo -n "."
|
254 |
echo -n "."
|
| 236 |
# We test the Ethernet links state
|
- |
|
| 237 |
for i in $EXTIF $INTIF
|
- |
|
| 238 |
do
|
255 |
|
| 239 |
/sbin/ip link set $i up
|
- |
|
| 240 |
sleep 3
|
- |
|
| 241 |
CMD=`/usr/sbin/ethtool $i |egrep 'Link detected'| awk '{print $NF}'`
|
- |
|
| 242 |
CMD2=`/sbin/mii-tool $i | grep link | awk '{print $NF}'`
|
- |
|
| 243 |
if [ $CMD != "yes" ] && [ $CMD2 != "ok" ]
|
- |
|
| 244 |
then
|
- |
|
| 245 |
if [ $Lang == "fr" ]
|
- |
|
| 246 |
then
|
- |
|
| 247 |
echo "Échec"
|
- |
|
| 248 |
echo "Le lien réseau de la carte $i n'est pas actif."
|
- |
|
| 249 |
echo "Réglez ce problème puis relancez ce script."
|
- |
|
| 250 |
else
|
- |
|
| 251 |
echo "Failed"
|
- |
|
| 252 |
echo "The link state of $i interface id down."
|
- |
|
| 253 |
echo "Resolv this problem, then restart this script."
|
- |
|
| 254 |
fi
|
- |
|
| 255 |
exit 0
|
- |
|
| 256 |
fi
|
- |
|
| 257 |
echo -n "."
|
- |
|
| 258 |
done
|
- |
|
| 259 |
# On teste la présence d'un routeur par défaut (Box FAI)
|
256 |
# Test if router is alive (Box FAI)
|
| 260 |
if [ `ip route list|grep -c ^default` -ne "1" ] ; then
|
257 |
if [ `ip route list|grep -c ^default` -ne "1" ] ; then
|
| 261 |
if [ $Lang == "fr" ]
|
258 |
if [ $Lang == "fr" ]
|
| 262 |
then
|
259 |
then
|
| 263 |
echo "Échec"
|
260 |
echo "Échec"
|
| 264 |
echo "Vous n'avez pas configuré l'accès à Internet ou le câble réseau n'est pas sur la bonne carte."
|
261 |
echo "Vous n'avez pas configuré l'accès à Internet ou le câble réseau n'est pas sur la bonne carte."
|