104,11 → 104,38 |
################################################################## |
## Function "testing" ## |
## - Test of Mageia version ## |
## - Test of ALCASAR version (if already installed) ## |
## - Test of free space on /var (>10G) ## |
## - Test of Internet access ## |
################################################################## |
testing () |
{ |
# Test of Mageia version |
# extract the current Mageia version and hardware architecture (i586 ou X64) |
fic=`cat /etc/product.id` |
unknown_os=0 |
old="$IFS" |
IFS="," |
set $fic |
for i in $* |
do |
if [ "`echo $i|grep distribution|cut -d'=' -f1`" == "distribution" ] |
then |
DISTRIBUTION=`echo $i|cut -d"=" -f2` |
unknown_os=`expr $unknown_os + 1` |
fi |
if [ "`echo $i|grep version|cut -d'=' -f1`" == "version" ] |
then |
CURRENT_VERSION=`echo $i|cut -d"=" -f2` |
unknown_os=`expr $unknown_os + 1` |
fi |
if [ "`echo $i|grep arch|cut -d'=' -f1`" == "arch" ] |
then |
ARCH=`echo $i|cut -d"=" -f2` |
unknown_os=`expr $unknown_os + 1` |
fi |
done |
IFS="$old" |
# Test if ALCASAR is already installed |
if [ -e $CONF_FILE ] |
then |
135,78 → 162,58 |
$DIR_SCRIPTS/alcasar-conf.sh --create |
mode="update" |
fi |
else |
if [ ! -d /var/log/netflow/porttracker ] |
fi |
if [[ ( $unknown_os != 3 ) || ("$DISTRIBUTION" != "Mageia" ) || ( "$CURRENT_VERSION" != "4" ) ]] |
then |
if [ -e /tmp/alcasar-conf.tar.gz ] # update |
then |
# Test of free space on /var |
free_space=`df -BG --output=avail /var|tail -1|tr -d [:space:]G` |
if [ $free_space -lt 10 ] |
then |
if [ $Lang == "fr" ] |
then echo "place disponible sur /var insufisante ($free_space Go au lieu de 10 Go au minimum)" |
else echo "not enough free space on /var ($free_space GB instead of at least 10 GB)" |
fi |
exit 0 |
fi |
fi |
# Test of Mageia version |
# extract the current Mageia version and hardware architecture (i586 ou X64) |
fic=`cat /etc/product.id` |
unknown_os=0 |
old="$IFS" |
IFS="," |
set $fic |
for i in $* |
do |
if [ "`echo $i|grep distribution|cut -d'=' -f1`" == "distribution" ] |
then |
DISTRIBUTION=`echo $i|cut -d"=" -f2` |
unknown_os=`expr $unknown_os + 1` |
fi |
if [ "`echo $i|grep version|cut -d'=' -f1`" == "version" ] |
then |
CURRENT_VERSION=`echo $i|cut -d"=" -f2` |
unknown_os=`expr $unknown_os + 1` |
fi |
if [ "`echo $i|grep arch|cut -d'=' -f1`" == "arch" ] |
then |
ARCH=`echo $i|cut -d"=" -f2` |
unknown_os=`expr $unknown_os + 1` |
fi |
done |
IFS="$old" |
if [[ ( $unknown_os != 3 || "$DISTRIBUTION" != "Mageia" ) && ( "$CURRENT_VERSION" != "4" ) ]] |
then |
echo |
if [ $Lang == "fr" ] |
then |
echo "L'installation ou la mise @ jour d'ALCASAR ne peut pas être réalisée." |
echo "Le système d'exploitation doit être remplacé (Mageia4)" |
echo "La mise à jour automatique d'ALCASAR ne peut pas être réalisée." |
echo "1 - Récupérez le fichier de configuration actuel (/tmp/alcasar-conf.tar.gz)." |
echo "2 - Installez Linux-Mageia4.1 (cf. doc d'installation)" |
echo "3 - recopiez le fichier 'alcasar-conf.tar.gz' dans le répertoire '/tmp' avant de lancer l'installation d'ALCASAR" |
else |
echo "The automatic update of ALCASAR can't be performed." |
echo "The OS must be replaced (Mageia4)" |
echo "1 - Retrieve the configuration file (/tmp/alcasar-conf.tar.gz)" |
echo "2 - Install Linux-Mageia4.1 (cf. installation doc)" |
echo "3 - Copy again the file 'alcasar-conf.tar.gz' in the folder '/tmp' before launching the installation of ALCASAR" |
fi |
if [ -e /tmp/alcasar-conf.tar.gz ] |
then |
echo |
if [ $Lang == "fr" ] |
then |
echo "1 - Récupérez le fichier de configuration actuel (/tmp/alcasar-conf.tar.gz)." |
echo "2 - Installez Linux-Mageia4 (cf. doc d'installation)" |
echo "3 - copiez le fichier 'alcasar-conf.tar.gz' dans le répertoire '/tmp' avant de lancer l'installation d'ALCASAR" |
else |
echo "1 - Retrieve the configuration file (/tmp/alcasar-conf.tar.gz)" |
echo "2 - Install Linux-Mageia4 (cf. installation doc)" |
echo "3 - Copy the file 'alcasar-conf.tar.gz' in the folder '/tmp' before launching the installation of ALCASAR" |
fi |
else |
if [ $Lang == "fr" ] |
then |
echo "L'installation d'ALCASAR ne peut pas être réalisée." |
else |
echo "The installation of ALCASAR can't be performed." |
fi |
exit 0 |
fi |
echo |
if [ $Lang == "fr" ] |
then |
echo "Le système d'exploitation doit être remplacé (Mageia4.1)" |
else |
echo "The OS must be replaced (Mageia4.1)" |
fi |
exit 0 |
fi |
if [ ! -d /var/log/netflow/porttracker ] |
then |
# Test of free space on /var |
free_space=`df -BG --output=avail /var|tail -1|tr -d [:space:]G` |
if [ $free_space -lt 10 ] |
then |
if [ $Lang == "fr" ] |
then echo "place disponible sur /var insufisante ($free_space Go au lieu de 10 Go au minimum)" |
else echo "not enough free space on /var ($free_space GB instead of at least 10 GB)" |
fi |
exit 0 |
fi |
fi |
if [ $Lang == "fr" ] |
then echo -n "Tests des paramètres réseau : " |
else echo -n "Network parameters tests : " |
fi |
|
# Test of Ethernet links state |
DOWN_IF=`/sbin/ip link|grep "NO-CARRIER"|cut -d":" -f2|tr -d " "` |
for i in $DOWN_IF |