From 9bbc22399840d16bd83449d26b3f3c760c3bfda5 Mon Sep 17 00:00:00 2001 From: drowe67 Date: Mon, 18 Jan 2010 05:55:15 +0000 Subject: [PATCH] first pass at ipkg, and web based package upgrade git-svn-id: https://svn.code.sf.net/p/freetel/code@133 01035d8c-6547-0410-b346-abe4f91aad63 --- mini-asterisk-gui/README.txt | 2 +- mini-asterisk-gui/cgi-bin/about.sh | 2 +- mini-asterisk-gui/cgi-bin/admin.sh | 30 ++++++++++++++++++++++ mini-asterisk-gui/cgi-bin/ipphones.sh | 2 +- mini-asterisk-gui/cgi-bin/phones.sh | 2 +- mini-asterisk-gui/cgi-bin/set_voiplines.sh | 2 +- mini-asterisk-gui/cgi-bin/tooltips.html | 6 ++--- mini-asterisk-gui/cgi-bin/voiplines.sh | 2 +- 8 files changed, 39 insertions(+), 9 deletions(-) diff --git a/mini-asterisk-gui/README.txt b/mini-asterisk-gui/README.txt index 5a9c7636..b16fc3ba 100644 --- a/mini-asterisk-gui/README.txt +++ b/mini-asterisk-gui/README.txt @@ -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]] diff --git a/mini-asterisk-gui/cgi-bin/about.sh b/mini-asterisk-gui/cgi-bin/about.sh index 8ca97111..9cf948d8 100644 --- a/mini-asterisk-gui/cgi-bin/about.sh +++ b/mini-asterisk-gui/cgi-bin/about.sh @@ -40,7 +40,7 @@ cat <

About

EOF -echo ' Mini Asterisk Revision: 122 ' +echo ' Mini Asterisk Revision: 132 ' echo '  ' echo ' Brought to you by the Free Telephony Project' echo ' ' diff --git a/mini-asterisk-gui/cgi-bin/admin.sh b/mini-asterisk-gui/cgi-bin/admin.sh index 9b309178..c89a30b8 100644 --- a/mini-asterisk-gui/cgi-bin/admin.sh +++ b/mini-asterisk-gui/cgi-bin/admin.sh @@ -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 < + + Mini Asterisk - Upgrade + + +

Upgrading...

+EOF + 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' + + # 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 "$rev_after installed" + echo "" + exit +fi + # Construct the web page ------------------------------- cat < + diff --git a/mini-asterisk-gui/cgi-bin/ipphones.sh b/mini-asterisk-gui/cgi-bin/ipphones.sh index 2ce904b1..f0733243 100644 --- a/mini-asterisk-gui/cgi-bin/ipphones.sh +++ b/mini-asterisk-gui/cgi-bin/ipphones.sh @@ -56,7 +56,7 @@ echo "$ipaddress " # 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 < diff --git a/mini-asterisk-gui/cgi-bin/phones.sh b/mini-asterisk-gui/cgi-bin/phones.sh index aa302f59..77dd9569 100644 --- a/mini-asterisk-gui/cgi-bin/phones.sh +++ b/mini-asterisk-gui/cgi-bin/phones.sh @@ -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< diff --git a/mini-asterisk-gui/cgi-bin/set_voiplines.sh b/mini-asterisk-gui/cgi-bin/set_voiplines.sh index 3039a260..68d50ed9 100644 --- a/mini-asterisk-gui/cgi-bin/set_voiplines.sh +++ b/mini-asterisk-gui/cgi-bin/set_voiplines.sh @@ -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 diff --git a/mini-asterisk-gui/cgi-bin/tooltips.html b/mini-asterisk-gui/cgi-bin/tooltips.html index 91137b23..2f5c46d2 100644 --- a/mini-asterisk-gui/cgi-bin/tooltips.html +++ b/mini-asterisk-gui/cgi-bin/tooltips.html @@ -136,9 +136,9 @@ off and back on.
- Press this button to the latest version of - Mini Asterisk. An Mini Asterisk upgrade - requires an Internet connection.
+ Press this button to install the latest + version of Mini Asterisk. An Mini Asterisk + upgrade requires an Internet connection.
Enter the URL of a firmware update script. diff --git a/mini-asterisk-gui/cgi-bin/voiplines.sh b/mini-asterisk-gui/cgi-bin/voiplines.sh index 9067ad49..c38295b1 100644 --- a/mini-asterisk-gui/cgi-bin/voiplines.sh +++ b/mini-asterisk-gui/cgi-bin/voiplines.sh @@ -53,7 +53,7 @@ cat <  EOF -./voiplines.pl +perl ./voiplines.pl cat <  -- 2.25.1