first pass at ipkg, and web based package upgrade
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Mon, 18 Jan 2010 05:55:15 +0000 (05:55 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Mon, 18 Jan 2010 05:55:15 +0000 (05:55 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@133 01035d8c-6547-0410-b346-abe4f91aad63

mini-asterisk-gui/README.txt
mini-asterisk-gui/cgi-bin/about.sh
mini-asterisk-gui/cgi-bin/admin.sh
mini-asterisk-gui/cgi-bin/ipphones.sh
mini-asterisk-gui/cgi-bin/phones.sh
mini-asterisk-gui/cgi-bin/set_voiplines.sh
mini-asterisk-gui/cgi-bin/tooltips.html
mini-asterisk-gui/cgi-bin/voiplines.sh

index 5a9c7636e93e8ee4c69f4e875fd6ba9146d372fa..b16fc3ba19faa22b090caf6a0d727ffb17dc049d 100644 (file)
@@ -195,7 +195,7 @@ Then stop and restart Asterisk.
 required are:
 +
 -------------------------------------------------------------------
-cgi.assign = ( ".sh" => "/bin/sh",".pl" => "/usr/sbin/microperl" )
+cgi.assign = ( ".sh" => "/bin/sh",".pl" => "/usr/bin/perl" )
 -------------------------------------------------------------------
 
 [[contribute]]
index 8ca9711155900100879712689649ce9e6e0affdc..9cf948d8bb27b0f62c16f46766989bed251d9c27 100644 (file)
@@ -40,7 +40,7 @@ cat <<EOF
     <table align="right" width=600>
       <tr><td align="left" valign="top"><h2>About</h2></td></tr>
 EOF
-echo '      <tr><td><a href="http://rowetel.com/ucasterisk/mini.html">Mini Asterisk</a> Revision: 122 </td></tr> '
+echo '      <tr><td><a href="http://rowetel.com/ucasterisk/mini.html">Mini Asterisk</a> Revision: 132 </td></tr> '
 echo '      <tr><td>&nbsp;</td></tr>'
 echo '      <tr><td>Brought to you by the <a href="http://rowetel.com/ucasterisk/index.html">Free Telephony Project</a></td></tr>'
 echo '      <tr><td><a href="http://rowetel.com/ucasterisk/ip04.html"><img src="http://rowetel.com/images/ip04/ip04_case.jpg" border="0" /></a></td></tr>'
index 9b3091782a0ef5bf97dc8375d408f9421edd05b8..c89a30b8f028c28902147de225a974b2f80745bb 100644 (file)
@@ -55,6 +55,35 @@ if [ $? -eq 0 ]; then
     asterisk -rx "dialplan reload" 2>/dev/null 1 > /dev/null
 fi
 
+# Upgrade Mini Asterisk CGI ----------------------------------------------------
+
+echo "$QUERY_STRING" | grep -oe "upgrade=1" > /dev/null
+if [ $? -eq 0 ]; then
+    cat <<EOF
+    <html>
+    <head>
+    <title>Mini Asterisk - Upgrade</title>
+    </head>
+    <body>
+    <h2>Upgrading...</h2>
+EOF
+    rev_before=`grep -oe "Revision: [0-9]*" /www/about.sh`
+    echo "<strong>Current $rev_before</strong><br>"
+    echo "<strong>Removing $ver_before</strong><br>"
+    ipkg remove mini-asterisk-gui | tr '\n' '#' | sed -n 's/\#/<br>/pg'
+    echo "<strong>Installing...</strong><br>"
+    ipkg update | tr '\n' '#' | sed -n 's/\#/<br>/pg'
+    ipkg install mini-asterisk-gui | tr '\n' '#' | sed -n 's/\#/<br>/pg'
+
+    # Note - never actually gets here as admin.sh is wiped out by upgrade..
+    # need a better way of handling this....
+
+    rev_after=`grep -oe "Revision: [0-9]*" /www/about.sh`
+    echo "<strong>$rev_after installed</strong>"
+    echo "</body></html>"
+    exit
+fi
+
 # Construct the web page -------------------------------
 
 cat <<EOF
@@ -118,6 +147,7 @@ cat <<EOF
               <form action="admin.sh" method="get">
               <input type="hidden" name="upgrade" value="1">
               <input type="submit" value="Upgrade">
+             </form>
           </td>
       </tr>
 
index 2ce904b130b1e582c2627e4e5b59cf942283e997..f073324356a78956d0513d7936a66f4b33fa49bc 100644 (file)
@@ -56,7 +56,7 @@ echo "<td>$ipaddress</td></tr><td>&nbsp;</td><tr></tr>"
 
     # use perl to construct list of IP phones for us
     asterisk "-rx sip show peers" 2>/dev/null > sipshowpeers.txt
-    ./ipphones.pl $ipaddress $more
+    perl ipphones.pl $ipaddress $more
 
 cat <<EOF
     </table>
index aa302f593324288d7c253c27a1d2f0615204307b..77dd9569654428d5722cb5a089d9ad7e75fc0abb 100644 (file)
@@ -80,7 +80,7 @@ EOF
 
 # use perl to construct list of phones and phone lines for us
 asterisk "-rx sip show peers" 2>/dev/null > sipshowpeers.txt
-./phones.pl
+perl ./phones.pl
 
 cat<<EOF
     </table>
index 3039a260187a7de0ad550a0c87ac39e2b9b0e0cd..68d50ed9e418a29d4eebd68c81dd716a3fd69ab3 100644 (file)
@@ -24,7 +24,7 @@ stanza=`echo "$QUERY_STRING" | grep -oe "stanza=[^&?]*" | sed -n "s/stanza=//p"`
 # create new sip.conf with selected provider uncommented
 
 echo "set_voiplines.sh" $user $pass $host $stanza >> /tmp/log.txt
-./set_voiplines.pl $user $pass $host $stanza > /etc/asterisk/sip.conf.new
+perl set_voiplines.pl $user $pass $host $stanza > /etc/asterisk/sip.conf.new
 mv /etc/asterisk/sip.conf /etc/asterisk/sip.conf.bak
 mv /etc/asterisk/sip.conf.new /etc/asterisk/sip.conf
 
index 91137b237c726543bdac39d2ad68ead8aafdc26c..2f5c46d276bbe04e9d3f2c9aa2ba044112d60da4 100644 (file)
                         off and back on. </div>
 
 <div id="admin_upgrade" class="tip">
-                        Press this button to the latest version of
-                       Mini Asterisk.  An Mini Asterisk upgrade
-                       requires an Internet connection.</div>
+                        Press this button to install the latest
+                       version of Mini Asterisk.  An Mini Asterisk
+                       upgrade requires an Internet connection.</div>
 
 <div id="admin_firmware" class="tip">
                         Enter the URL of a firmware update script.
index 9067ad496a019db97d6c841ba21c0b279f77259d..c38295b1b0c77fe7ecb7f43c319eb3bab832cf7a 100644 (file)
@@ -53,7 +53,7 @@ cat <<EOF
       <tr><td>&nbsp</td></tr>
 EOF
 
-./voiplines.pl
+perl ./voiplines.pl
 
 cat <<EOF
       <tr><td>&nbsp</td></tr>