pari: branch aadk r516 - /branches/aadk/scripts/networking.sh

asterisk-gui-commits at lists.digium.com asterisk-gui-commits at lists.digium.com
Wed Mar 28 13:02:53 MST 2007


Author: pari
Date: Wed Mar 28 15:02:52 2007
New Revision: 516

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=516
Log:
apply network settings in seperate phases

Modified:
    branches/aadk/scripts/networking.sh

Modified: branches/aadk/scripts/networking.sh
URL: http://svn.digium.com/view/asterisk-gui/branches/aadk/scripts/networking.sh?view=diff&rev=516&r1=515&r2=516
==============================================================================
--- branches/aadk/scripts/networking.sh (original)
+++ branches/aadk/scripts/networking.sh Wed Mar 28 15:02:52 2007
@@ -22,64 +22,76 @@
 #	 Now for the real logic in the script.                     #
 #	(Note: You CANNOT use functions with msh/busybox.)	   #
 ####################################################################
-############### Set our hostname real quick
-if [ "$HOSTNAME" != "" ]
-then
-hostname $HOSTNAME&
-fi
-
-###############	Set our time server
-if [ "$NTP_LAN" != "" ]
-then
-ntpdate $NTP_LAN&
-fi
-
-
+#################### Testing which string we are sending ##########
+case $options in 
 ####################################################################
 #								   #
 #		First we will do the WAN interface.		   #
 #								   #
 ####################################################################
 
-if [ "$DHCP_WAN" = "on" ] #If dhcp_wan is set from the gui
-then
-	dhcpcd -k
-	dhcpcd $WAN_INTERFACE& 
-else
-	ifconfig $WAN_INTERFACE down # Take down our interface real quick for changes..
-	ifconfig $WAN_INTERFACE $IP_WAN netmask $SUBNET_WAN # Add our basic values to ifconfig
-	echo "`cat $DNS_CONFIG | grep search`" > ${DNS_CONFIG}.tmp # Save the previous "search" field
-	mv ${DNS_CONFIG}.tmp $DNS_CONFIG # you cannot cat from the same file your writing to.
-	echo "nameserver $DNS_WAN" > $DNS_CONFIG # Add the ip/hostname of the nameserver
-	route add default gw $GATEWAY_WAN dev $WAN_INTERFACE # Add our default gateway for the wan interface
-	ifconfig $WAN_INTERFACE up # bring it up with our new settings
-fi 
-
+WAN)
+	if [ "$DHCP_WAN" = "on" ] #If dhcp_wan is set from the gui
+	then
+		dhcpcd -k
+		dhcpcd $WAN_INTERFACE& 
+	else
+		ifconfig $WAN_INTERFACE down # Take down our interface real quick for changes..
+		ifconfig $WAN_INTERFACE $IP_WAN netmask $SUBNET_WAN # Add our basic values to ifconfig
+		echo "`cat $DNS_CONFIG | grep search`" > ${DNS_CONFIG}.tmp # Save the previous "search" field
+		mv ${DNS_CONFIG}.tmp $DNS_CONFIG # you cannot cat from the same file your writing to.
+		echo "nameserver $DNS_WAN" > $DNS_CONFIG # Add the ip/hostname of the nameserver
+		route add default gw $GATEWAY_WAN dev $WAN_INTERFACE # Add our default gateway for the wan interface
+		ifconfig $WAN_INTERFACE up # bring it up with our new settings
+	fi 
+	;;	
+	
+LAN)
 ####################################################################
 #								   #
 #		Now we will do the LAN interface(s).		   #
 #								   #
 ####################################################################
 
-if [ "$DHCP_LAN" = "off" ] # They do not want to use dhcp on the network
-then
-	# We could exit now? Since we arent going to be distributing any IP's, clients are on their own.
-	echo "dhcp for lan is off"
-else
-	ifconfig $LAN_INTERFACE down # Take down our interface real quick for changes..
-	ifconfig $LAN_INTERFACE $IP_LAN netmask $SUBNET_LAN # Add our basic values to ifconfig
-	route add default gw $GATEWAY_LAN dev $LAN_INTERFACE # Add our default gateway for the Lan interface
-	ifconfig $LAN_INTERFACE up # bring it up with our new settings
+	if [ "$DHCP_LAN" = "off" ] # They do not want to use dhcp on the network
+	then
+		# We could exit now? Since we arent going to be distributing any IP's, clients are on their own.
+		echo "dhcp for lan is off"
+	else
+		ifconfig $LAN_INTERFACE down # Take down our interface real quick for changes..
+		ifconfig $LAN_INTERFACE $IP_LAN netmask $SUBNET_LAN # Add our basic values to ifconfig
+		route add default gw $GATEWAY_LAN dev $LAN_INTERFACE # Add our default gateway for the Lan interface
+		ifconfig $LAN_INTERFACE up # bring it up with our new settings
+	fi
+	;;
 
+
+LAN_OPTS)
 	# Now we will edit /etc/udhcpd.conf	
-	echo "start $START_RANGE_LAN" > $DHCP_CONFIG
-	echo "end $END_RANGE_LAN" >> $DHCP_CONFIG
-	echo "interface $LAN_INTERFACE" >> $DHCP_CONFIG
-	echo "max_leases $MAX_LEASE" >> $DHCP_CONFIG
+	if [ "$START_RANGE_LAN" != "" ]
+	then
+		echo "start $START_RANGE_LAN" > $DHCP_CONFIG
+	fi
+	if [ "$END_RANGE_LAN" != "" ]
+	then
+		echo "end $END_RANGE_LAN" >> $DHCP_CONFIG
+	fi
+	
+	if [ "$LAN_INTERFACE" != "" ]
+	then
+		echo "interface $LAN_INTERFACE" >> $DHCP_CONFIG
+	fi
+
+	if [ "$MAX_LEASE" != "" ]
+	then
+		echo "max_leases $MAX_LEASE" >> $DHCP_CONFIG
+	fi
+
 	if [ "$DNS_LAN" != "" ]
 	then
 		echo "opt dns $DNS_LAN" >> $DHCP_CONFIG
 	fi
+
 	if [ "$ROUTER_LAN" != "" ]
 	then
 		echo "opt router $ROUTER_LAN" >> $DHCP_CONFIG
@@ -88,16 +100,19 @@
 	then
 		echo "opt domain $DOMAIN_LAN" >> $DHCP_CONFIG
 	fi
+
 	if [ "$LEASE_LAN" != "" ]
 	then 
 		echo "opt lease $LEASE_LAN" >> $DHCP_CONFIG
 	else
 		echo "opt lease 8640000" >> $DHCP_CONFIG
 	fi
+
 	if [ "$TFTP_LAN" != "" ]
 	then
 		echo "opt tftp $TFTP_LAN" >> $DHCP_CONFIG
 	fi
+
 	if [ "$NTP_LAN" != "" ]
 	then
 		echo "opt ntpsrv $NTP_LAN" >> $DHCP_CONFIG
@@ -105,8 +120,23 @@
 	########Stop and restart our dhcp server.################
 	killall -9 $DHCP_SERVER; $DHCP_BIN&
 	##########Done###########################################
-fi
-				
+	;;
+
+MISC)
+	############### Set our hostname real quick
+	if [ "$HOSTNAME" != "" ]
+	then
+		hostname $HOSTNAME&
+	fi
+
+	###############	Set our time server
+	if [ "$NTP_LAN" != "" ]
+	then
+		ntpdate $NTP_LAN&
+	fi
+	;;
+			
+esac	
 	
 	
 	



More information about the asterisk-gui-commits mailing list