Subversion Repositories ALCASAR

Rev

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

Rev 2899 Rev 2947
Line 1... Line 1...
1
#!/bin/bash
1
#!/bin/bash
2
# $Id: alcasar-conf.sh 2899 2020-12-14 23:21:01Z rexy $
2
# $Id: alcasar-conf.sh 2947 2021-04-21 16:36:52Z rexy $
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 217... Line 217...
217
		PUBLIC_IP_MASK=`grep ^PUBLIC_IP= $CONF_FILE|cut -d"=" -f2`
217
		PUBLIC_IP_MASK=`grep ^PUBLIC_IP= $CONF_FILE|cut -d"=" -f2`
218
		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"
218
		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"
219
		if [[ "$PUBLIC_IP_MASK" == "dhcp" ]]
219
		if [[ "$PUBLIC_IP_MASK" == "dhcp" ]]
220
		then
220
		then
221
			PUBLIC_GATEWAY="dhcp"
221
			PUBLIC_GATEWAY="dhcp"
-
 
222
			DHCP_DNS_servers=`cat /var/lib/dhclient/dhclient--$EXTIF.lease |grep domain-name-servers|sed -n "1 p"| rev|cut -d" " -f1|rev|tr -d ';'`
-
 
223
			DNS1=`echo $DHCP_DNS_servers | cut -d"," -f1`
-
 
224
			DNS2=`echo $DHCP_DNS_servers | cut -d"," -f2`
222
		else
225
		else
223
			if ! echo $PUBLIC_IP_MASK | egrep -q $PTN
226
			if ! echo $PUBLIC_IP_MASK | egrep -q $PTN
224
			then
227
			then
225
				echo "Syntax error for PUBLIC_IP_MASK ($PUBLIC_IP_MASK)"
228
				echo "Syntax error for PUBLIC_IP_MASK ($PUBLIC_IP_MASK)"
226
				exit 0
229
				exit 0
Line 231... Line 234...
231
			if ! echo $PUBLIC_GATEWAY | egrep -q $PTN
234
			if ! echo $PUBLIC_GATEWAY | egrep -q $PTN
232
			then
235
			then
233
				echo "Syntax error for the Gateway IP ($PUBLIC_GATEWAY)"
236
				echo "Syntax error for the Gateway IP ($PUBLIC_GATEWAY)"
234
				exit 0
237
				exit 0
235
			fi
238
			fi
236
		fi
-
 
237
		DNS1=`grep ^DNS1= $CONF_FILE|cut -d"=" -f2`
239
			DNS1=`grep ^DNS1= $CONF_FILE|cut -d"=" -f2`
238
		if ! echo $DNS1 | egrep -q $PTN
240
			if ! echo $DNS1 | egrep -q $PTN
239
		then
241
			then
240
			echo "Syntax error for the IP address of the first DNS server ($DNS1)"
242
				echo "Syntax error for the IP address of the first DNS server ($DNS1)"
241
			exit 0
243
				exit 0
242
		fi
244
			fi
243
		DNS2=`grep ^DNS2= $CONF_FILE|cut -d"=" -f2`
245
			DNS2=`grep ^DNS2= $CONF_FILE|cut -d"=" -f2`
244
		if ! echo $DNS2 | egrep -q $PTN
246
			if ! echo $DNS2 | egrep -q $PTN
245
		then
247
			then
246
			echo "Syntax error for the IP address of the second DNS server ($DNS2)"
248
				echo "Syntax error for the IP address of the second DNS server ($DNS2)"
247
			exit 0
249
				exit 0
-
 
250
			fi
248
		fi
251
		fi
249
		PRIVATE_IP=`echo $PRIVATE_IP_MASK | cut -d"/" -f1`
252
		PRIVATE_IP=`echo $PRIVATE_IP_MASK | cut -d"/" -f1`
250
		PRIVATE_NETMASK=`/bin/ipcalc -m $PRIVATE_IP_MASK | cut -d"=" -f2`
253
		PRIVATE_NETMASK=`/bin/ipcalc -m $PRIVATE_IP_MASK | cut -d"=" -f2`
251
		private_network_calc
254
		private_network_calc
252
		INSTALL_DATE=`grep ^INSTALL_DATE= $CONF_FILE|cut -d"=" -f2`
255
		INSTALL_DATE=`grep ^INSTALL_DATE= $CONF_FILE|cut -d"=" -f2`
Line 264... Line 267...
264
				$DIR_BIN/alcasar-dhcp.sh --on
267
				$DIR_BIN/alcasar-dhcp.sh --on
265
			fi
268
			fi
266
# Set the local DNS (or not)
269
# Set the local DNS (or not)
267
			if [ "$INT_DNS_mode" = "on" ] || [ "$INT_DNS_mode" = "On" ] || [ "$INT_DNS_mode" = "ON" ]
270
			if [ "$INT_DNS_mode" = "on" ] || [ "$INT_DNS_mode" = "On" ] || [ "$INT_DNS_mode" = "ON" ]
268
			then
271
			then
269
				$DIR_BIN/alcasar-dns-local.sh --on
272
				$DIR_BIN/alcasar-dns-local.sh --on-without-restart
270
			else
273
			else
271
				$DIR_BIN/alcasar-dns-local.sh --off
274
				$DIR_BIN/alcasar-dns-local.sh --off-without-restart
272
			fi
275
			fi
273
# Set the pure ip option (or not)
276
# Set the pure ip option (or not)
274
			if [ "$BL_PUREIP" = "off" ] || [ "$BL_PUREIP" = "Off" ] || [ "$BL_PUREIP" = "OFF" ]
277
			if [ "$BL_PUREIP" = "off" ] || [ "$BL_PUREIP" = "Off" ] || [ "$BL_PUREIP" = "OFF" ]
275
			then
278
			then
276
				bl_filter_param+="--pureip_off"
279
				bl_filter_param+="--pureip_off"