pari: branch aadk r518 - in /branches/aadk: config/ scripts/

asterisk-gui-commits at lists.digium.com asterisk-gui-commits at lists.digium.com
Wed Mar 28 14:38:58 MST 2007


Author: pari
Date: Wed Mar 28 16:38:57 2007
New Revision: 518

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=518
Log:
This is still buggy - whenever we hit apply settings eth0 goes down - brandon said he will look into this later

Modified:
    branches/aadk/config/networking.html
    branches/aadk/scripts/networking.sh

Modified: branches/aadk/config/networking.html
URL: http://svn.digium.com/view/asterisk-gui/branches/aadk/config/networking.html?view=diff&rev=518&r1=517&r2=518
==============================================================================
--- branches/aadk/config/networking.html (original)
+++ branches/aadk/config/networking.html Wed Mar 28 16:38:57 2007
@@ -38,24 +38,7 @@
 
 
 	networkingcallbacks.savechanges = function(){
-		var cmd1 = "sh /etc/asterisk/networking.sh options=WAN DHCP_WAN=" + _$('DHCP_WAN').value + " IP_WAN=" + _$('IP_WAN').value + " SUBNET_WAN=" + _$('SUBNET_WAN').value + " GATEWAY_WAN=" + _$('GATEWAY_WAN').value + " DNS_WAN=" + _$('DNS_WAN').value ;
-	
-		var cmd2 = "sh /etc/asterisk/networking.sh options=LAN DHCP_LAN=" + _$('DHCP_LAN').value + " IP_LAN=" + _$('IP_LAN').value + " SUBNET_LAN=" + _$('SUBNET_LAN').value + " GATEWAY_LAN=" + _$('GATEWAY_LAN').value ;
-	
-		var cmd3 = "sh /etc/asterisk/networking.sh options=LAN2 DNS_LAN=" + _$('DNS_LAN').value + " START_RANGE_LAN=" + _$('START_RANGE_LAN').value + " END_RANGE_LAN=" + _$('END_RANGE_LAN').value ;
-	
-		var cmd4 = "sh /etc/asterisk/networking.sh options=MISC SSH_STATUS=" + _$('SSH_STATUS').value + " HOSTNAME=" + _$('HOSTNAME').value + " LEASE_LAN=" + _$('LEASE_LAN').value + " NTP_LAN=" + _$('NTP_LAN').value + " TFTP_LAN=" + _$('TFTP_LAN').value + " DOMAIN_LAN=" + _$('DOMAIN_LAN').value ;
-	
-		parent.astmanEngine.run_tool(cmd1 , onSuccess = function() { 
-			parent.astmanEngine.run_tool(cmd2 , onSuccess = function() {
-				parent.astmanEngine.run_tool(cmd3 , onSuccess = function() {
-					parent.astmanEngine.run_tool(cmd4 , onSuccess = function() {
-	
-					}); 
-				}); 
-			});
-		});
-		/*	 This is a total hack, but the appliance only 256 characters, so we have to split them up :[ */
+		parent.astmanEngine.run_tool("sh /etc/asterisk/networking.sh options=WAN DHCP_WAN=" + _$('DHCP_WAN').value + " IP_WAN=" + _$('IP_WAN').value + " SUBNET_WAN=" + _$('SUBNET_WAN').value + " GATEWAY_WAN=" + _$('GATEWAY_WAN').value + " DNS_WAN=" + _$('DNS_WAN').value + " DHCP_LAN=" + _$('DHCP_LAN').value + " IP_LAN=" + _$('IP_LAN').value + " SUBNET_LAN=" + _$('SUBNET_LAN').value + " GATEWAY_LAN=" + _$('GATEWAY_LAN').value + " DNS_LAN=" + _$('DNS_LAN').value + " START_RANGE_LAN=" + _$('START_RANGE_LAN').value + " END_RANGE_LAN=" + _$('END_RANGE_LAN').value + " SSH_STATUS=" + _$('SSH_STATUS').value + " HOSTNAME=" + _$('HOSTNAME').value + " LEASE_LAN=" + _$('LEASE_LAN').value + " NTP_LAN=" + _$('NTP_LAN').value + " TFTP_LAN=" + _$('TFTP_LAN').value + " DOMAIN_LAN=" + _$('DOMAIN_LAN').value); 
 		/* Lets hope this does not character buffer overflow :( */
 	}
 

Modified: branches/aadk/scripts/networking.sh
URL: http://svn.digium.com/view/asterisk-gui/branches/aadk/scripts/networking.sh?view=diff&rev=518&r1=517&r2=518
==============================================================================
--- branches/aadk/scripts/networking.sh (original)
+++ branches/aadk/scripts/networking.sh Wed Mar 28 16:38:57 2007
@@ -22,76 +22,64 @@
 #	 Now for the real logic in the script.                     #
 #	(Note: You CANNOT use functions with msh/busybox.)	   #
 ####################################################################
-#################### Testing which string we are sending ##########
-case $options in 
+############### Set our hostname real quick
+if [ "$HOSTNAME" != "" ]
+then
+hostname $HOSTNAME&
+fi
+
+###############	Set our time server
+if [ "$NTP_LAN" != "" ]
+then
+ntpdate $NTP_LAN&
+fi
+
+
 ####################################################################
 #								   #
 #		First we will do the WAN interface.		   #
 #								   #
 ####################################################################
 
-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)
+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 
+
 ####################################################################
 #								   #
 #		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
-	fi
-	;;
+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
 
-
-LAN_OPTS)
 	# Now we will edit /etc/udhcpd.conf	
-	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
-
+	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 [ "$DNS_LAN" != "" ]
 	then
 		echo "opt dns $DNS_LAN" >> $DHCP_CONFIG
 	fi
-
 	if [ "$ROUTER_LAN" != "" ]
 	then
 		echo "opt router $ROUTER_LAN" >> $DHCP_CONFIG
@@ -100,19 +88,16 @@
 	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
@@ -120,23 +105,8 @@
 	########Stop and restart our dhcp server.################
 	killall -9 $DHCP_SERVER; $DHCP_BIN&
 	##########Done###########################################
-	;;
-
-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	
+fi
+				
 	
 	
 	



More information about the asterisk-gui-commits mailing list