Subversion Repositories ALCASAR

Rev

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

Rev 1585 Rev 1590
Line 1... Line 1...
1
#/bin/bash
1
#/bin/bash
2
# $Id: alcasar-conf.sh 1585 2015-03-06 16:15:41Z richard $
2
# $Id: alcasar-conf.sh 1590 2015-03-09 21:41:03Z richard $
3
 
3
 
4
# alcasar-conf.sh
4
# alcasar-conf.sh
5
# by REXY
5
# by REXY
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 163... Line 163...
163
		then 
163
		then 
164
			echo "Syntax error for PRIVATE_IP_MASK ($PRIVATE_IP_MASK)"
164
			echo "Syntax error for PRIVATE_IP_MASK ($PRIVATE_IP_MASK)"
165
			exit 0
165
			exit 0
166
		fi
166
		fi
167
		PUBLIC_IP_MASK=`grep ^PUBLIC_IP $CONF_FILE|cut -d"=" -f2`
167
		PUBLIC_IP_MASK=`grep ^PUBLIC_IP $CONF_FILE|cut -d"=" -f2`
-
 
168
		PTN="\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b"
168
		if [[ "$PUBLIC_IP_MASK" == "dhcp" ]]
169
		if [[ "$PUBLIC_IP_MASK" == "dhcp" ]]
169
		then
170
		then
170
			PUBLIC_GATEWAY="dhcp"
171
			PUBLIC_GATEWAY="dhcp"
171
			DNS1="dhcp"
-
 
172
			DNS2="dhcp"
172
 
173
		else
173
		else
174
			check=$(echo $PUBLIC_IP_MASK | egrep $PTN)
174
			check=$(echo $PUBLIC_IP_MASK | egrep $PTN)
175
			if [[ "$?" -ne 0 ]]
175
			if [[ "$?" -ne 0 ]]
176
			then 
176
			then 
177
				echo "Syntax error for PUBLIC_IP_MASK ($PUBLIC_IP_MASK)"
177
				echo "Syntax error for PUBLIC_IP_MASK ($PUBLIC_IP_MASK)"
178
				exit 0
178
				exit 0
179
			fi
179
			fi
-
 
180
			PUBLIC_IP=`echo $PUBLIC_IP_MASK | cut -d"/" -f1`
180
			PTN="\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b"
181
			PUBLIC_NETMASK=`/bin/ipcalc -m $PUBLIC_IP_MASK | cut -d"=" -f2`
181
			PUBLIC_GATEWAY=`grep ^GW $CONF_FILE|cut -d"=" -f2`
182
			PUBLIC_GATEWAY=`grep ^GW $CONF_FILE|cut -d"=" -f2`
182
			check=$(echo $PUBLIC_GATEWAY | egrep $PTN)
183
			check=$(echo $PUBLIC_GATEWAY | egrep $PTN)
183
			if [[ "$?" -ne 0 ]]
184
			if [[ "$?" -ne 0 ]]
184
			then 
185
			then 
185
				echo "Syntax error for the Gateway IP ($PUBLIC_GATEWAY)"
186
				echo "Syntax error for the Gateway IP ($PUBLIC_GATEWAY)"
186
				exit 0
187
				exit 0
187
			fi
188
			fi
-
 
189
		fi
188
			DNS1=`grep ^DNS1 $CONF_FILE|cut -d"=" -f2`
190
		DNS1=`grep ^DNS1 $CONF_FILE|cut -d"=" -f2`
189
			check=$(echo $DNS1 | egrep $PTN)
191
		check=$(echo $DNS1 | egrep $PTN)
190
			if [[ "$?" -ne 0 ]]
192
		if [[ "$?" -ne 0 ]]
191
			then 
193
		then 
192
				echo "Syntax error for the IP address of the first DNS server ($DNS1)"
194
			echo "Syntax error for the IP address of the first DNS server ($DNS1)"
193
				exit 0
195
			exit 0
194
			fi
196
		fi
195
			DNS2=`grep ^DNS2 $CONF_FILE|cut -d"=" -f2`
197
		DNS2=`grep ^DNS2 $CONF_FILE|cut -d"=" -f2`
196
			check=$(echo $DNS2 | egrep $PTN)
198
		check=$(echo $DNS2 | egrep $PTN)
197
			if [[ "$?" -ne 0 ]]
199
		if [[ "$?" -ne 0 ]]
198
			then 
200
		then 
199
				echo "Syntax error for the IP address of the second DNS server ($DNS2)"
201
			echo "Syntax error for the IP address of the second DNS server ($DNS2)"
200
				exit 0
202
			exit 0
201
			fi
-
 
202
			PUBLIC_IP=`echo $PUBLIC_IP_MASK | cut -d"/" -f1`
-
 
203
			PUBLIC_NETMASK=`/bin/ipcalc -m $PUBLIC_IP_MASK | cut -d"=" -f2`
-
 
204
		fi
203
		fi
205
		PRIVATE_IP=`echo $PRIVATE_IP_MASK | cut -d"/" -f1`
204
		PRIVATE_IP=`echo $PRIVATE_IP_MASK | cut -d"/" -f1`
206
		PRIVATE_NETMASK=`/bin/ipcalc -m $PRIVATE_IP_MASK | cut -d"=" -f2`
205
		PRIVATE_NETMASK=`/bin/ipcalc -m $PRIVATE_IP_MASK | cut -d"=" -f2`
207
		private_network_calc
206
		private_network_calc
208
		INSTALL_DATE=`grep INSTALL_DATE $CONF_FILE|cut -d"=" -f2`
207
		INSTALL_DATE=`grep INSTALL_DATE $CONF_FILE|cut -d"=" -f2`