fff-web: fix uci command line syntax

Signed-off-by: Tim Niemeyer <tim@tn-x.org>
Reviewed-by: Christian Dresel <fff@chrisi01.de>
Reviewed-by: Jan Kraus <mayosemmel@gmail.com>
This commit is contained in:
Tim Niemeyer 2017-02-17 08:06:51 +01:00
parent 9be699dbf9
commit 8460b603ec
3 changed files with 27 additions and 27 deletions

View File

@ -2,12 +2,12 @@
<%
echo -en "Content-Type: text/html\r\n\r\n"
HOSTNAME=$(uci get -q 'system.@system[0].hostname')
HOSTNAME=$(uci -q get 'system.@system[0].hostname')
MAC="$(uci -q get network.mesh.macaddr)"
lat="$(uci get -q system.@system[0].latitude)"
lon="$(uci get -q system.@system[0].longitude)"
contact="$(uci get -q system.@system[0].contact)"
lat="$(uci -q get system.@system[0].latitude)"
lon="$(uci -q get system.@system[0].longitude)"
contact="$(uci -q get system.@system[0].contact)"
. /etc/firmware_release
@ -47,11 +47,11 @@ contact="$(uci get -q system.@system[0].contact)"
<tr><th>MAC-Adresse:</th><td style="text-transform: uppercase;"><a href="https://monitoring.freifunk-franken.de/api/get_router_by_mac/<%= $MAC %>"><%= $MAC %></a></td></tr>
<tr><th>Modell:</th><td><% cat /tmp/sysinfo/model 2>/dev/null %></td></tr>
<tr><th>Firmware:</th><td><%= ${FIRMWARE_VERSION} %></td></tr>
<tr><th>Beschreibung:</th><td><% uci get -q 'system.@system[0].description' %></td></tr>
<tr><th>Beschreibung:</th><td><% uci -q get 'system.@system[0].description' %></td></tr>
<tr><th>Position:</th><td><% if [ -n "$lat" -a -n "$lon" ]; then
echo "<a href=\"https://monitoring.freifunk-franken.de/map?mapcenter=$lat,$lon,16\">${lat:0:8}N, ${lon:0:8}E</a>"
fi %></td></tr>
<tr><th>Standort:</th><td><% uci get -q 'system.@system[0].position_comment' %></td></tr>
<tr><th>Standort:</th><td><% uci -q get 'system.@system[0].position_comment' %></td></tr>
<tr><th>E-Mail Adresse:</th><td><a href="mailto:<%= $contact %>"><%= $contact %></a></td></tr>
</table>
</fieldset>

View File

@ -10,7 +10,7 @@ nav_entry() {
echo -ne "\t<li${class_active}><a href=\"${script_file}\">$2</a></li>\n\t\t"
}
HOSTNAME=$(uci get -q 'system.@system[0].hostname')
HOSTNAME=$(uci -q get 'system.@system[0].hostname')
%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

View File

@ -13,23 +13,23 @@ if [ "$REQUEST_METHOD" == "POST" ] ; then
MSG='<span class="red">Knotenname enth&auml;lt ung&uuml;ltige Zeichen!</span>'
else
# Allgemeine Einstellungen
uci set -q "system.@system[0].hostname=${POST_hostname}"
uci get -q 'system.@system[0].hostname' > /proc/sys/kernel/hostname
uci set -q "system.@system[0].description=${POST_description}"
uci set -q "system.@system[0].latitude=${POST_latitude}"
uci set -q "system.@system[0].longitude=${POST_longitude}"
uci set -q "system.@system[0].position_comment=${POST_position_comment}"
uci set -q "system.@system[0].contact=${POST_contact}"
uci -q set "system.@system[0].hostname=${POST_hostname}"
uci -q get 'system.@system[0].hostname' > /proc/sys/kernel/hostname
uci -q set "system.@system[0].description=${POST_description}"
uci -q set "system.@system[0].latitude=${POST_latitude}"
uci -q set "system.@system[0].longitude=${POST_longitude}"
uci -q set "system.@system[0].position_comment=${POST_position_comment}"
uci -q set "system.@system[0].contact=${POST_contact}"
# Bitratenbegrenzung
if [ "$POST_traffic_limit" == "on" ] ; then
uci set -q "simple-tc.example.ifname=$(uci -q get network.wan.ifname)"
uci set -q "simple-tc.example.enabled=1"
uci -q set "simple-tc.example.ifname=$(uci -q get network.wan.ifname)"
uci -q set "simple-tc.example.enabled=1"
else
uci set -q "simple-tc.example.enabled=0"
uci -q set "simple-tc.example.enabled=0"
fi
uci set -q "simple-tc.example.limit_ingress=${POST_limit_ingress}"
uci set -q "simple-tc.example.limit_egress=${POST_limit_egress}"
uci -q set "simple-tc.example.limit_ingress=${POST_limit_ingress}"
uci -q set "simple-tc.example.limit_egress=${POST_limit_egress}"
uci commit
MSG='<span class="green">Daten gespeichert! - Bitte Router neustarten.</span>'
@ -40,7 +40,7 @@ fi
<%in /www/ssl/cgi-bin/helpers %>
<%
# read
if [ "$(uci get -q 'simple-tc.example.enabled')" == "1" ] ; then
if [ "$(uci -q get 'simple-tc.example.enabled')" == "1" ] ; then
traffic_checked="checked"
else
traffic_checked=""
@ -54,16 +54,16 @@ fi
<legend>Allgemeine Einstellungen</legend>
<table>
<tr><th>Knotenname:</th><td><input type="text" name="hostname" value="<%= ${HOSTNAME} %>" /></td></tr>
<tr><th>Knotenbeschreibung:</th><td><input type="text" name="description" value="<%= $(uci get -q 'system.@system[0].description') %>" /></td></tr>
<tr><th>Knotenbeschreibung:</th><td><input type="text" name="description" value="<%= $(uci -q get 'system.@system[0].description') %>" /></td></tr>
<tr><th>GPS Breitengrad:</th>
<td><input type="text" name="latitude" value="<%= $(uci get -q 'system.@system[0].latitude') %>" /></td>
<td><input type="text" name="latitude" value="<%= $(uci -q get 'system.@system[0].latitude') %>" /></td>
<td rowspan="2" style="vertical-align: middle;">
<button type="button" style="height: 100%; width: 126px; margin-left: 5px;" onclick="window.open('/map.html', '_blank', 'location=0,status=0,scrollbars=1,width=400,height=300');">Position auf Karte anzeigen / setzen</button>
</td>
</tr>
<tr><th>GPS L&auml;ngengrad:</th><td><input type="text" name="longitude" value="<%= $(uci get -q 'system.@system[0].longitude') %>" /></td></tr>
<tr><th>Standortbeschreibung:</th><td><input type="text" name="position_comment" value="<%= $(uci get -q 'system.@system[0].position_comment') %>" /></td></tr>
<tr><th>E-Mail Adresse:</th><td><input type="email" name="contact" value="<%= $(uci get -q 'system.@system[0].contact') %>" /></td></tr>
<tr><th>GPS L&auml;ngengrad:</th><td><input type="text" name="longitude" value="<%= $(uci -q get 'system.@system[0].longitude') %>" /></td></tr>
<tr><th>Standortbeschreibung:</th><td><input type="text" name="position_comment" value="<%= $(uci -q get 'system.@system[0].position_comment') %>" /></td></tr>
<tr><th>E-Mail Adresse:</th><td><input type="email" name="contact" value="<%= $(uci -q get 'system.@system[0].contact') %>" /></td></tr>
</table>
</fieldset>
</td><td>
@ -73,8 +73,8 @@ fi
<tr><th>Aktiviert:</th><td colspan="2">
<input type="checkbox" name="traffic_limit" <%= ${traffic_checked} %>>
</td></tr>
<tr><th>Freifunk&nbsp;Download:</th><td><input type="text" name="limit_ingress" value="<%= $(uci get -q 'simple-tc.example.limit_ingress') %>" /></td><td>kbit/s</td></tr>
<tr><th>Freifunk&nbsp;Upload:</th><td><input type="text" name="limit_egress" value="<%= $(uci get -q 'simple-tc.example.limit_egress') %>" /></td><td>kbit/s</td></tr>
<tr><th>Freifunk&nbsp;Download:</th><td><input type="text" name="limit_ingress" value="<%= $(uci -q get 'simple-tc.example.limit_ingress') %>" /></td><td>kbit/s</td></tr>
<tr><th>Freifunk&nbsp;Upload:</th><td><input type="text" name="limit_egress" value="<%= $(uci -q get 'simple-tc.example.limit_egress') %>" /></td><td>kbit/s</td></tr>
</table>
</fieldset>
</td></tr>