From: horse69 Date: Thu, 31 May 2012 06:48:57 +0000 (+0000) Subject: git-svn-id: https://svn.code.sf.net/p/freetel/code@525 01035d8c-6547-0410-b346-abe4f9... X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=26979c1f950294b11afe7b10a22025306b47c963;p=freetel-svn-tracking.git git-svn-id: https://svn.code.sf.net/p/freetel/code@525 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/mini-asterisk-gui2/cgi-bin/install.cgi b/mini-asterisk-gui2/cgi-bin/install.cgi new file mode 100755 index 00000000..29b936e6 --- /dev/null +++ b/mini-asterisk-gui2/cgi-bin/install.cgi @@ -0,0 +1,49 @@ +#!/bin/sh +# install.cgi +# Ian Roberts 31 May 2012 +# +# CGI to install new firmware.... +# runs a shellscript as root + +cat < + + + + + +EOF + + +# check what sort of machine we are running on. Many operations +# outlawed for x86 + +cat /proc/cpuinfo | grep "CPU:.*ADSP" > /dev/null +if [ $? -eq 0 ]; then + mach="ip0x" +else + mach="x86" +fi + + + +if [ $mach != "ip0x" ] ; then + echo "Sorry, only supported on the IP0X" + exit +fi + +firmwareurl=`echo "$QUERY_STRING" | grep -oe "firmwareurl=[^&?]*" | sed -n "s/firmwareurl=//p"` +# convert URL encoded string, this can just handle : and / so be careful +# with script names +firmwareurl=`echo $firmwareurl | sed -e "s/%3A/:/" -e "s_%2F_/_g"` +wget $firmwareurl +filename=`echo $firmwareurl | sed 's_^.*/__'` +sh $filename +exit + +cat < + +EOF diff --git a/mini-asterisk-gui2/cgi-bin/reset.cgi b/mini-asterisk-gui2/cgi-bin/reset.cgi new file mode 100755 index 00000000..984bb49e --- /dev/null +++ b/mini-asterisk-gui2/cgi-bin/reset.cgi @@ -0,0 +1,51 @@ +#!/bin/sh +# reset.cgi +# Ian Roberts 31 May 2012 +# +# CGI to reset ipox + +cat < + + + + + +EOF + + +# check what sort of machine we are running on. Many operations +# outlawed for x86 + +cat /proc/cpuinfo | grep "CPU:.*ADSP" > /dev/null +if [ $? -eq 0 ]; then + mach="ip0x" +else + mach="x86" +fi + + + +if [ $mach != "ip0x" ] ; then + echo "Sorry, only supported on the IP0X" +cat < + +EOF + exit +fi + +# reset the dialplan files +cp /etc/asterisk/extensions.conf.def /etc/asterisk/extensions.conf +cp /etc/asterisk/sip.conf.def /etc/asterisk/sip.conf +# reload the dialplans in asterisk +asterisk -rx "sip reload" 2>/dev/null 1 > /dev/null +asterisk -rx "dialplan reload" 2>/dev/null 1 > /dev/null + + +cat < + +EOF diff --git a/mini-asterisk-gui2/cgi-bin/setpassword.cgi b/mini-asterisk-gui2/cgi-bin/setpassword.cgi new file mode 100755 index 00000000..b0765e52 --- /dev/null +++ b/mini-asterisk-gui2/cgi-bin/setpassword.cgi @@ -0,0 +1,43 @@ +#!/bin/sh +# setpassword.cgi +# Ian Roberts 31 May 2012 +# +# CGI to set password on ipox + +cat < + + + + + +EOF + + +# check what sort of machine we are running on. Many operations +# outlawed for x86 + +cat /proc/cpuinfo | grep "CPU:.*ADSP" > /dev/null +if [ $? -eq 0 ]; then + mach="ip0x" +else + mach="x86" +fi + + + +if [ $mach != "ip0x" ] ; then + echo "Sorry, only supported on the IP0X" + exit +fi + +pass=`echo "$QUERY_STRING" | grep -oe "pass=[^&?]*" | sed -n "s/pass=//p"` +passwd_cmdline $pass + + +cat < + +EOF diff --git a/mini-asterisk-gui2/cgi-bin/upgrade.cgi b/mini-asterisk-gui2/cgi-bin/upgrade.cgi new file mode 100755 index 00000000..e22f5d26 --- /dev/null +++ b/mini-asterisk-gui2/cgi-bin/upgrade.cgi @@ -0,0 +1,54 @@ +#!/bin/sh +# upgrade.cgi +# Ian Roberts 31 May 2012 +# +# CGI to upgrade mini-asterisk-gui + +cat < + + + + + +EOF + + +# check what sort of machine we are running on. Many operations +# outlawed for x86 + +cat /proc/cpuinfo | grep "CPU:.*ADSP" > /dev/null +if [ $? -eq 0 ]; then + mach="ip0x" +else + mach="x86" +fi + + + +if [ $mach != "ip0x" ] ; then + echo "Sorry, only supported on the IP0X" +cat < + +EOF + exit +fi + +# remove, update and install mini-asterisk-gui + +rev_before=`grep -oe "Revision: [0-9]*" /www/about.sh` +echo "Current $rev_before
" +echo "Removing $ver_before
" +ipkg remove mini-asterisk-gui | tr '\n' '#' | sed -n 's/\#/
/pg' +echo "Installing...
" +ipkg update | tr '\n' '#' | sed -n 's/\#/
/pg' +ipkg install mini-asterisk-gui | tr '\n' '#' | sed -n 's/\#/
/pg' + + +cat < + +EOF