From c621193c1b437225c39b881b1de9e96874192bd5 Mon Sep 17 00:00:00 2001 From: drowe67 Date: Thu, 7 Jan 2010 00:17:05 +0000 Subject: [PATCH] added some cross-platform support git-svn-id: https://svn.code.sf.net/p/freetel/code@103 01035d8c-6547-0410-b346-abe4f91aad63 --- easy-asterisk-gui/Makefile | 2 +- easy-asterisk-gui/about.sh | 40 ++++++++++++++++++++------------ easy-asterisk-gui/index.html | 5 ++++ easy-asterisk-gui/network.sh | 34 ++++++++++++++++++++++++++- easy-asterisk-gui/set_network.sh | 2 -- 5 files changed, 64 insertions(+), 19 deletions(-) create mode 100644 easy-asterisk-gui/index.html diff --git a/easy-asterisk-gui/Makefile b/easy-asterisk-gui/Makefile index b0ab04b3..729c8240 100644 --- a/easy-asterisk-gui/Makefile +++ b/easy-asterisk-gui/Makefile @@ -8,5 +8,5 @@ # make TESTIP=boris test test: - rcp faq.sh faq.html about.sh at-530.html ipphones.pl ipphones.sh ipphones.js voipline.jpg anphone.png phoneline.jpg ipphone.png phones.pl tooltips.html phones.sh phones.js tick.png cross.png banner.html menu.html check_loggedin.sh logout.sh login.sh network.sh network.js set_network.sh tooltip.js tooltip.css root@$(TESTIP):/www/cgi-bin + rcp index.html faq.sh faq.html about.sh at-530.html ipphones.pl ipphones.sh ipphones.js voipline.jpg anphone.png phoneline.jpg ipphone.png phones.pl tooltips.html phones.sh phones.js tick.png cross.png banner.html menu.html check_loggedin.sh logout.sh login.sh network.sh network.js set_network.sh tooltip.js tooltip.css root@$(TESTIP):/www/cgi-bin rcp sip.conf extensions.conf root@$(TESTIP):/etc/asterisk diff --git a/easy-asterisk-gui/about.sh b/easy-asterisk-gui/about.sh index 63b99f0e..a6fd49ca 100644 --- a/easy-asterisk-gui/about.sh +++ b/easy-asterisk-gui/about.sh @@ -42,6 +42,9 @@ cat <

About

EOF echo ' Easy Asterisk $Revision$ ' | sed -n 's/\$//pg' +echo '  ' +echo ' Brought to you by the Free Telephony Project' +echo ' ' more=`echo "$QUERY_STRING" | grep -oe "more=[^&?]*" | sed -n "s/more=//p"` if [ $more -eq 1 ]; then @@ -66,11 +69,14 @@ echo " " cat /proc/version echo " " -echo "  " -echo "

ipkg list_installed

" -echo " " -ipkg list_installed | tr '\n' '#' | sed -n 's/\#/
/pg' -echo " " +which ipkg >> /dev/null +if [ $? -eq 0 ]; then + echo "  " + echo "

ipkg list_installed

" + echo " " + ipkg list_installed | tr '\n' '#' | sed -n 's/\#/
/pg' + echo " " +fi echo "  " echo "

cat /proc/loadavg

" @@ -102,17 +108,21 @@ echo " " cat /proc/cpuinfo echo " " -echo "  " -echo "

cat /proc/mtd

" -echo " " -cat /proc/mtd | tr '\n' '#' | sed -n 's/\#/
/pg' -echo " " +if [ -f /proc/mtd ]; then + echo "  " + echo "

cat /proc/mtd

" + echo " " + cat /proc/mtd | tr '\n' '#' | sed -n 's/\#/
/pg' + echo " " +fi -echo "  " -echo "

cat /proc/yaffs

" -echo " " -cat /proc/yaffs | tr '\n' '#' | sed -n 's/\#/
/pg' -echo " " +if [ -f /proc/yaffs ]; then + echo "  " + echo "

cat /proc/yaffs

" + echo " " + cat /proc/yaffs | tr '\n' '#' | sed -n 's/\#/
/pg' + echo " " +fi echo "  " echo ' Less'; diff --git a/easy-asterisk-gui/index.html b/easy-asterisk-gui/index.html new file mode 100644 index 00000000..8514560b --- /dev/null +++ b/easy-asterisk-gui/index.html @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/easy-asterisk-gui/network.sh b/easy-asterisk-gui/network.sh index 1a683bce..982a63bc 100644 --- a/easy-asterisk-gui/network.sh +++ b/easy-asterisk-gui/network.sh @@ -15,9 +15,10 @@ if [ $? -eq 1 ]; then exit fi -echo `date` " get_network.sh" >> /tmp/easy_gui.log +grok_network=0 if [ -f /etc/rc.d/S10network ]; then + grok_network=1 dhcp=yes ipaddress=`ifconfig eth0 | sed -n 's/.*inet addr:\(.*\) Bcast.*/\1/p'` netmask=`ifconfig eth0 | sed -n 's/.*Mask:\(.*\)\s*/\1/p'` @@ -27,6 +28,7 @@ fi if [ -f /etc/rc.d/S10network-static ] then + grok_network=1 dhcp=no ipaddress=`sed -n 's/IPADDRESS="\(.*\)"/\1/p' /etc/init.d/network-static` netmask=`sed -n 's/NETMASK="\(.*\)"/\1/p' /etc/init.d/network-static` @@ -34,6 +36,36 @@ then dns=`sed -n 's/DNS="\(.*\)"/\1/p' /etc/init.d/network-static` fi +# if we don't understand this machines network config then bail + +if [ $groknetwork -eq 0 ]; then +cat << EOF + +Easy Asterisk - Network +EOF + +cat tooltips.html +echo '' +cat banner.html +echo " " +cat menu.html +cat < +
+ + + +

Network

Sorry - I can't edit the Network configuration on this machine
+ + + + + + +EOF +fi + if [ -f /etc/rc.d/S05network-backdoor ]; then backdoor=`sed -n 's/IPADDRESS="\(.*\)"/\1/p' /etc/init.d/network-backdoor` fi diff --git a/easy-asterisk-gui/set_network.sh b/easy-asterisk-gui/set_network.sh index dddb65af..23c69e78 100755 --- a/easy-asterisk-gui/set_network.sh +++ b/easy-asterisk-gui/set_network.sh @@ -22,8 +22,6 @@ gateway=`echo "$QUERY_STRING" | grep -oe "gateway=[^&?]*" | sed -n "s/gateway=// dns=`echo "$QUERY_STRING" | grep -oe "dns=[^&?]*" | sed -n "s/dns=//p"` backdoor=`echo "$QUERY_STRING" | grep -oe "backdoor=[^&?]*" | sed -n "s/backdoor=//p"` -echo `date` " set_network.sh $dhcp $ipaddress $netmask $gateway $dns $backdoor" >> /tmp/easy_gui.log - if [ $dhcp == "yes" ]; then # DHCP -- 2.25.1