Subversion Repositories ALCASAR

Rev

Rev 1527 | Rev 1530 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 1527 Rev 1529
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
#  $Id: alcasar.sh 1527 2014-12-21 11:00:21Z franck $ 
2
#  $Id: alcasar.sh 1529 2014-12-21 16:17:23Z 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 102... Line 102...
102
}
102
}
103
 
103
 
104
##################################################################
104
##################################################################
105
##			Function "testing"			##
105
##			Function "testing"			##
106
## - Test of Mageia version					##
106
## - Test of Mageia version					##
-
 
107
## - Test of ALCASAR version (if already installed)		##
107
## - Test of free space on /var  (>10G)				##
108
## - Test of free space on /var  (>10G)				##
108
## - Test of Internet access					##
109
## - Test of Internet access					##
109
##################################################################
110
##################################################################
110
testing ()
111
testing ()
111
{
112
{
-
 
113
# Test of Mageia version
-
 
114
# extract the current Mageia version and hardware architecture (i586 ou X64)
-
 
115
	fic=`cat /etc/product.id`
-
 
116
	unknown_os=0
-
 
117
	old="$IFS"
-
 
118
	IFS=","
-
 
119
	set $fic
-
 
120
	for i in $*
-
 
121
	do
-
 
122
		if [ "`echo $i|grep distribution|cut -d'=' -f1`" == "distribution" ]
-
 
123
			then 
-
 
124
			DISTRIBUTION=`echo $i|cut -d"=" -f2`
-
 
125
			unknown_os=`expr $unknown_os + 1`
-
 
126
		fi
-
 
127
		if [ "`echo $i|grep version|cut -d'=' -f1`" == "version" ]
-
 
128
			then 
-
 
129
			CURRENT_VERSION=`echo $i|cut -d"=" -f2`
-
 
130
			unknown_os=`expr $unknown_os + 1`
-
 
131
		fi
-
 
132
		if [ "`echo $i|grep arch|cut -d'=' -f1`" == "arch" ]
-
 
133
			then 
-
 
134
			ARCH=`echo $i|cut -d"=" -f2`
-
 
135
			unknown_os=`expr $unknown_os + 1`
-
 
136
		fi
-
 
137
	done
-
 
138
	IFS="$old"
112
# Test if ALCASAR is already installed
139
# Test if ALCASAR is already installed
113
	if [ -e $CONF_FILE ]
140
	if [ -e $CONF_FILE ]
114
	then
141
	then
115
		current_version=`cat $CONF_FILE | grep VERSION | cut -d"=" -f2`
142
		current_version=`cat $CONF_FILE | grep VERSION | cut -d"=" -f2`
116
		if [ $Lang == "fr" ]
143
		if [ $Lang == "fr" ]
Line 133... Line 160...
133
		else
160
		else
134
# Create a backup of running importants files
161
# Create a backup of running importants files
135
			$DIR_SCRIPTS/alcasar-conf.sh --create
162
			$DIR_SCRIPTS/alcasar-conf.sh --create
136
			mode="update"
163
			mode="update"
137
		fi
164
		fi
138
	else
-
 
139
		if [ ! -d /var/log/netflow/porttracker ]
-
 
140
			then
-
 
141
# Test of free space on /var
-
 
142
			free_space=`df -BG --output=avail /var|tail -1|tr -d [:space:]G`
-
 
143
			if [ $free_space -lt 10 ]
-
 
144
				then
-
 
145
				if [ $Lang == "fr" ]
-
 
146
					then echo "place disponible sur /var insufisante ($free_space Go au lieu de 10 Go au minimum)"
-
 
147
					else echo "not enough free space on /var ($free_space GB instead of at least 10 GB)"
-
 
148
				fi
-
 
149
			exit 0
-
 
150
			fi
-
 
151
		fi
165
	fi
152
# Test of Mageia version
-
 
153
# extract the current Mageia version and hardware architecture (i586 ou X64)
-
 
154
		fic=`cat /etc/product.id`
-
 
155
		unknown_os=0
-
 
156
		old="$IFS"
-
 
157
		IFS=","
-
 
158
		set $fic
-
 
159
		for i in $*
-
 
160
		do
-
 
161
			if [ "`echo $i|grep distribution|cut -d'=' -f1`" == "distribution" ]
166
	if [[ ( $unknown_os != 3 ) || ("$DISTRIBUTION" != "Mageia" ) || ( "$CURRENT_VERSION" != "4" ) ]]
162
				then 
-
 
163
				DISTRIBUTION=`echo $i|cut -d"=" -f2`
-
 
164
				unknown_os=`expr $unknown_os + 1`
-
 
165
			fi
-
 
166
			if [ "`echo $i|grep version|cut -d'=' -f1`" == "version" ]
-
 
167
				then 
167
		then
168
				CURRENT_VERSION=`echo $i|cut -d"=" -f2`
-
 
169
				unknown_os=`expr $unknown_os + 1`
-
 
170
			fi
-
 
171
			if [ "`echo $i|grep arch|cut -d'=' -f1`" == "arch" ]
168
		if [ -e /tmp/alcasar-conf.tar.gz ] # update
172
				then 
-
 
173
				ARCH=`echo $i|cut -d"=" -f2`
-
 
174
				unknown_os=`expr $unknown_os + 1`
-
 
175
			fi
-
 
176
		done
-
 
177
		IFS="$old"
-
 
178
		if [[ ( $unknown_os != 3 || "$DISTRIBUTION" != "Mageia" ) && ( "$CURRENT_VERSION" != "4" ) ]]
-
 
179
			then
169
			then
-
 
170
			echo
180
			if [ $Lang == "fr" ]
171
			if [ $Lang == "fr" ]
181
				then	
172
				then	
182
				echo "L'installation ou la mise @ jour d'ALCASAR ne peut pas être réalisée."
173
				echo "La mise à jour automatique d'ALCASAR ne peut pas être réalisée."
-
 
174
				echo "1 - Récupérez le fichier de configuration actuel (/tmp/alcasar-conf.tar.gz)."
183
				echo "Le système d'exploitation doit être remplacé (Mageia4)"
175
				echo "2 - Installez Linux-Mageia4.1 (cf. doc d'installation)"
-
 
176
				echo "3 - recopiez le fichier 'alcasar-conf.tar.gz' dans le répertoire '/tmp' avant de lancer l'installation d'ALCASAR"
184
			else
177
			else
185
				echo "The automatic update of ALCASAR can't be performed."
178
				echo "The automatic update of ALCASAR can't be performed."
-
 
179
				echo "1 - Retrieve the configuration file (/tmp/alcasar-conf.tar.gz)"
186
				echo "The OS must be replaced (Mageia4)"
180
				echo "2 - Install Linux-Mageia4.1 (cf. installation doc)"
-
 
181
				echo "3 - Copy again the file 'alcasar-conf.tar.gz' in the folder '/tmp' before launching the installation of ALCASAR"
187
			fi
182
			fi
188
			if [ -e /tmp/alcasar-conf.tar.gz ]
-
 
189
				then
-
 
190
				echo
183
		else
191
				if [ $Lang == "fr" ]
184
			if [ $Lang == "fr" ]
192
					then	
185
				then	
193
					echo "1 - Récupérez le fichier de configuration actuel (/tmp/alcasar-conf.tar.gz)."
-
 
194
					echo "2 - Installez Linux-Mageia4 (cf. doc d'installation)"
186
				echo "L'installation d'ALCASAR ne peut pas être réalisée."
195
					echo "3 - copiez le fichier 'alcasar-conf.tar.gz' dans le répertoire '/tmp' avant de lancer l'installation d'ALCASAR"
-
 
196
				else
187
			else
197
					echo "1 - Retrieve the configuration file (/tmp/alcasar-conf.tar.gz)"
-
 
198
					echo "2 - Install Linux-Mageia4 (cf. installation doc)"
188
				echo "The installation of ALCASAR can't be performed."
199
					echo "3 - Copy the file 'alcasar-conf.tar.gz' in the folder '/tmp' before launching the installation of ALCASAR"
-
 
200
				fi
-
 
201
			fi
189
			fi
-
 
190
		fi
-
 
191
		echo
-
 
192
		if [ $Lang == "fr" ]
-
 
193
			then	
-
 
194
			echo "Le système d'exploitation doit être remplacé (Mageia4.1)"
-
 
195
		else
-
 
196
			echo "The OS must be replaced (Mageia4.1)"
-
 
197
		fi
202
			exit 0
198
		exit 0
-
 
199
	fi
-
 
200
	if [ ! -d /var/log/netflow/porttracker ]
-
 
201
		then
-
 
202
# Test of free space on /var
-
 
203
		free_space=`df -BG --output=avail /var|tail -1|tr -d [:space:]G`
-
 
204
		if [ $free_space -lt 10 ]
-
 
205
			then
-
 
206
			if [ $Lang == "fr" ]
-
 
207
				then echo "place disponible sur /var insufisante ($free_space Go au lieu de 10 Go au minimum)"
-
 
208
				else echo "not enough free space on /var ($free_space GB instead of at least 10 GB)"
-
 
209
			fi
-
 
210
		exit 0
203
		fi
211
		fi
204
	fi
212
	fi
205
	if [ $Lang == "fr" ]
213
	if [ $Lang == "fr" ]
206
		then echo -n "Tests des paramètres réseau : "
214
		then echo -n "Tests des paramètres réseau : "
207
		else echo -n "Network parameters tests : "
215
		else echo -n "Network parameters tests : "
208
	fi
216
	fi
209
 
-
 
210
# Test of Ethernet links state
217
# Test of Ethernet links state
211
	DOWN_IF=`/sbin/ip link|grep "NO-CARRIER"|cut -d":" -f2|tr -d " "`
218
	DOWN_IF=`/sbin/ip link|grep "NO-CARRIER"|cut -d":" -f2|tr -d " "`
212
	for i in $DOWN_IF
219
	for i in $DOWN_IF
213
	do
220
	do
214
		if [ $Lang == "fr" ]
221
		if [ $Lang == "fr" ]