forked from freifunk-franken/firmware
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:
parent
9be699dbf9
commit
8460b603ec
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
<%
|
<%
|
||||||
echo -en "Content-Type: text/html\r\n\r\n"
|
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)"
|
MAC="$(uci -q get network.mesh.macaddr)"
|
||||||
lat="$(uci get -q system.@system[0].latitude)"
|
lat="$(uci -q get system.@system[0].latitude)"
|
||||||
lon="$(uci get -q system.@system[0].longitude)"
|
lon="$(uci -q get system.@system[0].longitude)"
|
||||||
contact="$(uci get -q system.@system[0].contact)"
|
contact="$(uci -q get system.@system[0].contact)"
|
||||||
|
|
||||||
. /etc/firmware_release
|
. /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>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>Modell:</th><td><% cat /tmp/sysinfo/model 2>/dev/null %></td></tr>
|
||||||
<tr><th>Firmware:</th><td><%= ${FIRMWARE_VERSION} %></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
|
<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>"
|
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>
|
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>
|
<tr><th>E-Mail Adresse:</th><td><a href="mailto:<%= $contact %>"><%= $contact %></a></td></tr>
|
||||||
</table>
|
</table>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
@ -10,7 +10,7 @@ nav_entry() {
|
||||||
echo -ne "\t<li${class_active}><a href=\"${script_file}\">$2</a></li>\n\t\t"
|
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">
|
%><!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">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
|
|
@ -13,23 +13,23 @@ if [ "$REQUEST_METHOD" == "POST" ] ; then
|
||||||
MSG='<span class="red">Knotenname enthält ungültige Zeichen!</span>'
|
MSG='<span class="red">Knotenname enthält ungültige Zeichen!</span>'
|
||||||
else
|
else
|
||||||
# Allgemeine Einstellungen
|
# Allgemeine Einstellungen
|
||||||
uci set -q "system.@system[0].hostname=${POST_hostname}"
|
uci -q set "system.@system[0].hostname=${POST_hostname}"
|
||||||
uci get -q 'system.@system[0].hostname' > /proc/sys/kernel/hostname
|
uci -q get 'system.@system[0].hostname' > /proc/sys/kernel/hostname
|
||||||
uci set -q "system.@system[0].description=${POST_description}"
|
uci -q set "system.@system[0].description=${POST_description}"
|
||||||
uci set -q "system.@system[0].latitude=${POST_latitude}"
|
uci -q set "system.@system[0].latitude=${POST_latitude}"
|
||||||
uci set -q "system.@system[0].longitude=${POST_longitude}"
|
uci -q set "system.@system[0].longitude=${POST_longitude}"
|
||||||
uci set -q "system.@system[0].position_comment=${POST_position_comment}"
|
uci -q set "system.@system[0].position_comment=${POST_position_comment}"
|
||||||
uci set -q "system.@system[0].contact=${POST_contact}"
|
uci -q set "system.@system[0].contact=${POST_contact}"
|
||||||
|
|
||||||
# Bitratenbegrenzung
|
# Bitratenbegrenzung
|
||||||
if [ "$POST_traffic_limit" == "on" ] ; then
|
if [ "$POST_traffic_limit" == "on" ] ; then
|
||||||
uci set -q "simple-tc.example.ifname=$(uci -q get network.wan.ifname)"
|
uci -q set "simple-tc.example.ifname=$(uci -q get network.wan.ifname)"
|
||||||
uci set -q "simple-tc.example.enabled=1"
|
uci -q set "simple-tc.example.enabled=1"
|
||||||
else
|
else
|
||||||
uci set -q "simple-tc.example.enabled=0"
|
uci -q set "simple-tc.example.enabled=0"
|
||||||
fi
|
fi
|
||||||
uci set -q "simple-tc.example.limit_ingress=${POST_limit_ingress}"
|
uci -q set "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_egress=${POST_limit_egress}"
|
||||||
|
|
||||||
uci commit
|
uci commit
|
||||||
MSG='<span class="green">Daten gespeichert! - Bitte Router neustarten.</span>'
|
MSG='<span class="green">Daten gespeichert! - Bitte Router neustarten.</span>'
|
||||||
|
@ -40,7 +40,7 @@ fi
|
||||||
<%in /www/ssl/cgi-bin/helpers %>
|
<%in /www/ssl/cgi-bin/helpers %>
|
||||||
<%
|
<%
|
||||||
# read
|
# read
|
||||||
if [ "$(uci get -q 'simple-tc.example.enabled')" == "1" ] ; then
|
if [ "$(uci -q get 'simple-tc.example.enabled')" == "1" ] ; then
|
||||||
traffic_checked="checked"
|
traffic_checked="checked"
|
||||||
else
|
else
|
||||||
traffic_checked=""
|
traffic_checked=""
|
||||||
|
@ -54,16 +54,16 @@ fi
|
||||||
<legend>Allgemeine Einstellungen</legend>
|
<legend>Allgemeine Einstellungen</legend>
|
||||||
<table>
|
<table>
|
||||||
<tr><th>Knotenname:</th><td><input type="text" name="hostname" value="<%= ${HOSTNAME} %>" /></td></tr>
|
<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>
|
<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;">
|
<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>
|
<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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><th>GPS Längengrad:</th><td><input type="text" name="longitude" value="<%= $(uci get -q 'system.@system[0].longitude') %>" /></td></tr>
|
<tr><th>GPS Lä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 get -q 'system.@system[0].position_comment') %>" /></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 get -q 'system.@system[0].contact') %>" /></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>
|
</table>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</td><td>
|
</td><td>
|
||||||
|
@ -73,8 +73,8 @@ fi
|
||||||
<tr><th>Aktiviert:</th><td colspan="2">
|
<tr><th>Aktiviert:</th><td colspan="2">
|
||||||
<input type="checkbox" name="traffic_limit" <%= ${traffic_checked} %>>
|
<input type="checkbox" name="traffic_limit" <%= ${traffic_checked} %>>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
<tr><th>Freifunk 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 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 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 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>
|
</table>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</td></tr>
|
</td></tr>
|
||||||
|
|
Loading…
Reference in New Issue