bkruse: branch aadk r591 - in /branches/aadk: config/ scripts/
asterisk-gui-commits at lists.digium.com
asterisk-gui-commits at lists.digium.com
Tue Apr 3 15:05:30 MST 2007
Author: bkruse
Date: Tue Apr 3 17:05:30 2007
New Revision: 591
URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=591
Log:
updated networking.html and networking.sh, now networking.sh is called with a parameter of the file it is supposed to include for variables (/etc/asterisk/scripts/network.params)
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=591&r1=590&r2=591
==============================================================================
--- branches/aadk/config/networking.html (original)
+++ branches/aadk/config/networking.html Tue Apr 3 17:05:30 2007
@@ -43,19 +43,20 @@
networkingcallbacks.savechanges = function(){
- parent.astmanEngine.run_tool("echo \"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/lib/asterisk/static-http/config/network.params");
-
- parent.astmanEngine.run_tool("echo \" 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 + "\" >> /var/lib/asterisk/static-http/config/network.params");
-
- parent.astmanEngine.run_tool("echo \" DNS_LAN=" + _$('DNS_LAN').value + " START_RANGE_LAN=" + _$('START_RANGE_LAN').value + " END_RANGE_LAN=" + _$('END_RANGE_LAN').value + " SSH_STATUS=" + _$('SSH_STATUS').value + "\" >> /var/lib/asterisk/static-http/config/network.params");
-
- parent.astmanEngine.run_tool("echo \" HOSTNAME=" + _$('HOSTNAME').value + " LEASE_LAN=" + _$('LEASE_LAN').value + " NTP_LAN=" + _$('NTP_LAN').value + " TFTP_LAN=" + _$('TFTP_LAN').value + " DOMAIN_LAN=" + _$('DOMAIN_LAN').value + " MAX_LEASE=" + _$('MAX_LEASE') + "\" >> /var/lib/asterisk/static-http/config/network.params");
-
- parent.astmanEngine.run_tool("sh /etc/asterisk/networking.sh");
-
- /* Now networking.sh includes the network.params file
- All the variables are now accessible through $name */
-
+
+ var param_file = "/etc/asterisk/scripts/network.params";
+ var network_script = "/etc/asterisk/scripts/networking.sh";
+ parent.astmanEngine.run_tool("echo \"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 + "\" > " + param_file);
+
+ parent.astmanEngine.run_tool("echo \" 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 + "\" >> " + param_file);
+
+ parent.astmanEngine.run_tool("echo \" DNS_LAN=" + _$('DNS_LAN').value + " START_RANGE_LAN=" + _$('START_RANGE_LAN').value + " END_RANGE_LAN=" + _$('END_RANGE_LAN').value + " SSH_STATUS=" + _$('SSH_STATUS').value + "\" >> " + param_file);
+
+ parent.astmanEngine.run_tool("echo \" HOSTNAME=" + _$('HOSTNAME').value + " LEASE_LAN=" + _$('LEASE_LAN').value + " NTP_LAN=" + _$('NTP_LAN').value + " TFTP_LAN=" + _$('TFTP_LAN').value + " DOMAIN_LAN=" + _$('DOMAIN_LAN').value + " MAX_LEASE=" + _$('MAX_LEASE') + "\" >> " + param_file);
+
+ parent.astmanEngine.run_tool("sh " + network_script + " " + param_file);
+
+ /* The bash script will take the first argument and 'include' it with the period(.) */
}
Modified: branches/aadk/scripts/networking.sh
URL: http://svn.digium.com/view/asterisk-gui/branches/aadk/scripts/networking.sh?view=diff&rev=591&r1=590&r2=591
==============================================================================
--- branches/aadk/scripts/networking.sh (original)
+++ branches/aadk/scripts/networking.sh Tue Apr 3 17:05:30 2007
@@ -4,6 +4,8 @@
# ##############################################################
# This is a bash script to apply network settings from the GUI.#
################################################################
+ARG_FILE=$1
+. $ARG_FILE # Include the file passed to us.
WAN_INTERFACE="eth0"
LAN_INTERFACE="eth1"
DNS_CONFIG="/etc/config/resolv.conf"
@@ -11,11 +13,6 @@
DHCP_BIN="`which udhcpd`"
DHCP_SERVER="udhcpd"
####################################################################
-
-for i in $* # This looks a little wierd, but its for setting our envirnment variables
-do
-export $i # If someone passed var=woot on the command line, we can access it easily using $var, automatically
-done
####################################################################
# #
@@ -25,13 +22,14 @@
############### Set our hostname real quick
if [ "$HOSTNAME" != "" ]
then
-hostname $HOSTNAME&
+hostname $HOSTNAME &
fi
############### Set our time server
if [ "$NTP_LAN" != "" ]
then
-ntpdate $NTP_LAN&
+killall -9 ntpdate
+ntpdate $NTP_LAN &
fi
@@ -43,16 +41,14 @@
if [ "$DHCP_WAN" = "on" ] #If dhcp_wan is set from the gui
then
- dhcpcd -k
- dhcpcd $WAN_INTERFACE&
+ killall -9 dhcpcd ; killall -9 dhcpcd.real
+ dhcpcd.real $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
+ route -n add $GATEWAY_WAN $WAN_INTERFACE # Add our default gateway for the wan interface
fi
####################################################################
@@ -66,10 +62,8 @@
# 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
+ route -n add $GATEWAY_LAN $LAN_INTERFACE # Add our default gateway for the Lan interface
# Now we will edit /etc/udhcpd.conf
echo "start $START_RANGE_LAN" > $DHCP_CONFIG
More information about the asterisk-gui-commits
mailing list