Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • ffnw-firmware/packages
  • pic/packages
  • PowerPan/packages
  • floh1111/packages
4 results
Show changes
Showing
with 0 additions and 663 deletions
config 'script'
option 'error_level' '0'
option 'logfile' '/var/log/configurator.log'
option 'version' '1'
option 'sync_hostname' '1'
config 'api'
option 'ipv4_address' '1'
option 'ipv6_interface' 'br-client'
option 'ipv6_address' 'netmon.ffnw'
option 'timeout' '5'
option 'retry' '5'
option 'api_key' '1'
config 'crawl'
option 'method' 'hash'
option 'nickname' '1'
option 'password' '1'
option 'login_string' '1'
option 'router_id' '1'
option 'update_hash' '1'
config 'netmon'
option 'autoadd_ipv6_address' '1'
#!/bin/sh
# Netmon Configurator (C) 2010-2012 Freifunk Oldenburg
# Lizenz: GPL v3
#Get the configuration from the uci configuration file
#If it does not exists, then get it from a normal bash file with variables.
if [ -f /etc/config/configurator ];then
API_IPV4_ADRESS=`uci get configurator.@api[0].ipv4_address`
API_IPV6_ADRESS=`uci get configurator.@api[0].ipv6_address`
API_TIMEOUT=`uci get configurator.@api[0].timeout`
API_RETRY=`uci get configurator.@api[0].retry`
SCRIPT_VERSION=`uci get configurator.@script[0].version`
SCRIPT_ERROR_LEVEL=`uci get configurator.@script[0].error_level`
SCRIPT_LOGFILE=`uci get configurator.@script[0].logfile`
SCRIPT_SYNC_HOSTNAME=`uci get configurator.@script[0].sync_hostname`
SCRIPT_LOCATION_SET=`uci get gluon-node-info.@location[0].share_location`
CRAWL_METHOD=`uci get configurator.@crawl[0].method`
CRAWL_ROUTER_ID=`uci get configurator.@crawl[0].router_id`
CRAWL_UPDATE_HASH=`uci get configurator.@crawl[0].update_hash`
CRAWL_NICKNAME=`uci get configurator.@crawl[0].nickname`
CRAWL_PASSWORD=`uci get configurator.@crawl[0].password`
AUTOADD_IPV6_ADDRESS=`uci get configurator.@netmon[0].autoadd_ipv6_address`
else
. `dirname $0`/configurator_config
fi
API_RETRY=$(($API_RETRY - 1))
if [[ $API_IPV4_ADRESS != "1" ]]; then
netmon_api=$API_IPV4_ADRESS
else
netmon_api=$API_IPV6_ADRESS
fi
if [ $SCRIPT_ERROR_LEVEL -gt "1" ]; then
err() {
echo "$(date) [configurator]: $1" >> $SCRIPT_LOGFILE
}
else
err() {
:
}
fi
sync_hostname() {
err "Syncing hostname"
api_return=$(wget -T $API_TIMEOUT -q -O - "http://$netmon_api/api_csv_configurator.php?section=get_hostname&authentificationmethod=$CRAWL_METHOD&nickname=$CRAWL_NICKNAME&password=$CRAWL_PASSWORD&router_auto_update_hash=$CRAWL_UPDATE_HASH&router_id=$CRAWL_ROUTER_ID")
ret=${api_return%%,*}
if [ "$ret" != "success" ]; then
err "Ther was an error fetching the hostname"
exit 0
elif [ "$ret" = "success" ]; then
netmon_hostname=${api_return%,*}
netmon_hostname=${netmon_hostname#*,}
#check for valid hostname as specified in rfc 1123
#see http://stackoverflow.com/a/3824105
regex='^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])'
regex=$regex'(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$'
if [ ${#netmon_hostname} -le 255 ]; then
if echo -n $netmon_hostname | egrep -q "$regex"; then
if [ "$netmon_hostname" != "`cat /proc/sys/kernel/hostname`" ]; then
err "Setting new hostname: $netmon_hostname"
uci set system.@system[0].hostname=$netmon_hostname
uci commit
echo $netmon_hostname > /proc/sys/kernel/hostname
else
err "Hostname is up to date"
fi
else
err "Hostname ist malformed"
exit 0
fi
else
err "Hostname exceeds the maximum length of 255 characters"
exit 0
fi
fi
}
assign_router() {
hostname=`cat /proc/sys/kernel/hostname`
#Choose right login String
#Here maybe a ; to much at the end..??
login_strings=$(awk '{ mac=toupper($1); gsub(":", "", mac); printf mac ";" }' /sys/class/net/br-client/address
/sys/class/net/eth0/address /sys/class/net/ath0/address 2> /dev/null)
ergebnis=$(wget -T $API_TIMEOUT -q -O - "http://$netmon_api/api_csv_configurator.php?section=test_login_strings&login_strings=$login_strings")
router_auto_assign_login_string=${ergebnis#*;}
ergebnis=${ergebnis%;*}
if [ "$ergebnis" = "error" ]; then
router_auto_assign_login_string=${login_strings%%;*}
err "A router with this login string does not exist: $login_strings"
err "Using $router_auto_assign_login_string as login string"
fi
#Try to assign Router with choosen login string
ergebnis=$(wget -T $API_TIMEOUT -q -O - "http://$netmon_api/api_csv_configurator.php?section=router_auto_assign&router_auto_assign_login_string=$router_auto_assign_login_string&hostname=$hostname")
ret=${ergebnis%%;*}
errstr=${ergebnis#*;}
errstr=${errstr%%;*}
if [ "$ret" != "success" ]; then
err "The router has not been assigned to a router in Netmon"
err "Failure on router_auto_assign: $errstr. Exiting"
exit 0
elif [ "$ret" = "success" ]; then
update_hash=${ergebnis%;*;*}
update_hash=${update_hash##*;}
api_key=${ergebnis##*;}
#write new config
uci set configurator.@crawl[0].router_id=$errstr
uci set configurator.@crawl[0].update_hash=$update_hash
uci set configurator.@api[0].api_key=$api_key
#set also new router id for nodewatcher
#uci set nodewatcher.@crawl[0].router_id=$errstr
err "The router $errstr has been assigned with a router in Netmon"
uci commit
CRAWL_METHOD=`uci get configurator.@crawl[0].method`
CRAWL_ROUTER_ID=$errstr
CRAWL_UPDATE_HASH=$update_hash
CRAWL_NICKNAME=`uci get configurator.@crawl[0].nickname`
CRAWL_PASSWORD=`uci get configurator.@crawl[0].password`
fi
}
autoadd_ipv6_address() {
err "Doing IPv6 autoadd"
ipv6_link_local_addr=$(ip addr show dev br-client scope link | awk '/inet6/{print $2}')
ipv6_link_local_netmask=${ipv6_link_local_addr##*/}
ipv6_link_local_addr=${ipv6_link_local_addr%%/*}
ergebnis=$(wget -T $API_TIMEOUT -q -O - "http://$netmon_api/api_csv_configurator.php?section=autoadd_ipv6_address&authentificationmethod=$CRAWL_METHOD&nickname=$CRAWL_NICKNAME&password=$CRAWL_PASSWORD&router_auto_update_hash=$CRAWL_UPDATE_HASH&router_id=$CRAWL_ROUTER_ID&networkinterface_name=br-client&ip=$ipv6_link_local_addr&netmask=$ipv6_link_local_netmask&ipv=6")
ret=${ergebnis%%,*}
if [ "$ret" = "success" ]; then
uci set configurator.@netmon[0].autoadd_ipv6_address='0'
uci commit
err "The IPv6 address of the router $CRAWL_ROUTER_ID has been added to the router in Netmon"
err "IPv6 Autoadd has been disabled cause it is no longer necesarry"
else
routerid=${ergebnis##*,}
if [ "$routerid" == "$CRAWL_ROUTER_ID" ]; then
err "The IPv6 address already exists in Netmon on this router. Maybe because of a previos assignment"
uci set configurator.@netmon[0].autoadd_ipv6_address='0'
uci commit
err "IPv6 Autoadd has been disabled cause it is no longer necesarry"
else
err "The IPv6 address already exists in Netmon on another router $routerid"
fi
fi
}
sync_geo_location(){
if [[ $(awk 'BEGIN{srand();print int(rand()*100)}') -lt 5 ]];then
Static_location=$(uci get gluon-node-info.@location[0].static_location)
if [ $Static_location -eq 0 ]; then
mac=$(uci get wireless.mesh_radio0.macaddr)
coords="$(wget -q -O - "http://${API_IPV6_ADRESS}/getcoords.php?mac=$mac")"
echo "$coords" | grep "[0-9]\{1,3\}\(\.[0-9]\)* [0-9]\{1,3\}\(\.[0-9]\)*"
if [ "$?" = "0" ]; then
lat="$(echo "$coords" | cut -d'|' -f1)"
lon="$(echo "$coords" | cut -d'|' -f2)"
uci set gluon-node-info.@location[0].auto_location=0
uci set gluon-node-info.@location[0].latitude=$lat
uci set gluon-node-info.@location[0].longitude=$lon
uci set gluon-node-info.@location[0].share_location=1
uci commit gluon-node-info.@location[0]
fi
fi
fi
}
sync_geo_location
if [ $CRAWL_METHOD == "login" ]; then
err "Authentification method is: username and passwort"
elif [ $CRAWL_METHOD == "hash" ]; then
err "Authentification method: autoassign and hash"
err "Checking if the router is already assigned to a router in Netmon"
if [ $CRAWL_UPDATE_HASH == "1" ]; then
err "The router is not assigned to a router in Netmon"
err "Trying to assign the router"
assign_router
else
err "The router is already assigned to a router in Netmon"
fi
fi
if [[ $AUTOADD_IPV6_ADDRESS = "1" ]]; then
autoadd_ipv6_address
fi
if [[ $SCRIPT_SYNC_HOSTNAME = "1" ]]; then
sync_hostname
fi
*/5 * * * * sh /lib/ffnw/configurator/configurator.sh;
#!/usr/bin/lua
local uci = require('luci.model.uci').cursor()
local config = 'configurator'
local ipv6_address = uci:get(config, uci:get_first(config, 'api'), 'ipv6_address')
if not ( ipv6_address == 'netmon.ffnw' ) then
uci:set(config, uci:get_first(config, 'api'), 'ipv6_address', 'netmon.ffnw')
uci:save(config)
uci:commit(config)
end
include $(TOPDIR)/rules.mk
PKG_NAME:=ffnw-fastdreg
PKG_VERSION:=1
PKG_RELEASE:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/ffnw-fastdreg
SECTION:=fastd
CATEGORY:=Freifunk Nordwest
TITLE:=Adds script which registers fastd-key
DEPENDS:=+gluon-mesh-vpn-fastd
endef
define Package/ffnw-fastdreg/description
Adds script which registers fastd-key
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/ffnw-fastdreg/install
$(INSTALL_DIR) $(1)/lib/gluon/cron/
$(INSTALL_DATA) files/lib/gluon/cron/fastdreg $(1)/lib/gluon/cron/fastdreg
$(INSTALL_DIR) $(1)/lib/ffnw/fastdreg/
$(INSTALL_BIN) files/lib/ffnw/fastdreg/fastdreg.sh $(1)/lib/ffnw/fastdreg/
$(INSTALL_DIR) $(1)/etc/config/
$(INSTALL_CONF) files/fastdreg.config $(1)/etc/config/fastdreg
endef
$(eval $(call BuildPackage,ffnw-fastdreg))
package fastdreg
config fastdreg ffnw
option regdone 0
package fastdreg
config fastdreg ffnw
option regdone 0
#!/bin/sh
. /lib/functions.sh
keysrv="http://vpn01.freifunk-ol.de"
hostname=$(uci get system.@system[0].hostname)
pubkey=$(/etc/init.d/fastd show_key mesh_vpn)
regdone=$(uci get fastdreg.ffnw.regdone)
if [ "$regdone" -ne "1" ]; then
reg=$(wget -T15 "$keysrv/reg.php?name=$hostname&key=$pubkey" -O -)
if [ "$reg" == "regdone" ]; then
uci set fastdreg.ffnw.regdone=1
uci commit
fi
fi
* * * * * /lib/ffnw/fastdreg/fastdreg.sh
include $(TOPDIR)/rules.mk
PKG_NAME:=ffnw-config-mode-contact-info
PKG_VERSION:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(GLUONDIR)/include/package.mk
PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG)
define Package/ffnw-config-mode-contact-info
SECTION:=config-mode
CATEGORY:=Freifunk Nordwest
TITLE:=Set a custom string that will be distributed in the mesh.
DEPENDS:=gluon-config-mode-core-virtual +ffnw-node-info
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
$(call GluonBuildI18N,ffnw-config-mode-contact-info,i18n)
endef
define Package/ffnw-config-mode-contact-info/install
$(CP) ./files/* $(1)/
$(call GluonInstallI18N,ffnw-config-mode-contact-info,$(1))
endef
$(eval $(call BuildPackage,ffnw-config-mode-contact-info))
local cbi = require "luci.cbi"
local i18n = require "luci.i18n"
local uci = luci.model.uci.cursor()
local M = {}
function M.section(form)
local s = form:section(cbi.SimpleSection, nil, i18n.translate(
'You can provide your contact information here to '
.. 'allow others to contact you. Please note that '
.. 'this information will be visible <em>publicly</em> '
.. 'on the internet together with your node\'s coordinates.'
)
)
local o = s:option(cbi.Value, "_contact", i18n.translate("Contact info"))
o.default = uci:get_first("gluon-node-info", "owner", "contact", "")
o.rmempty = true
o.datatype = "string"
o.description = i18n.translate("e.g. E-mail or phone number")
o.maxlen = 140
end
function M.handle(data)
if data._contact ~= nil then
uci:set("gluon-node-info", uci:get_first("gluon-node-info", "owner"), "contact", data._contact)
else
uci:delete("gluon-node-info", uci:get_first("gluon-node-info", "owner"), "contact")
end
uci:save("gluon-node-info")
uci:commit("gluon-node-info")
end
return M
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"PO-Revision-Date: 2015-03-19 01:32+0100\n"
"Last-Translator: Matthias Schiffer <mschiffer@universe-factory.net>\n"
"Language-Team: German\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Contact info"
msgstr "Kontakt"
msgid ""
"You can provide your contact information here to allow others to contact "
"you. Please note that this information will be visible <em>publicly</em> on "
"the internet together with your node's coordinates."
msgstr ""
"Hier kannst du einen <em>öffentlichen</em> Hinweis hinterlegen, um anderen "
"zu ermöglichen, Kontakt mit dir aufzunehmen. Bitte beachte, dass "
"dieser Hinweis auch öffentlich im Internet, zusammen mit den Koordinaten "
"deines Knotens, einsehbar sein wird."
msgid "e.g. E-mail or phone number"
msgstr "z.B. E-Mail oder Telefonnummer"
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "Contact info"
msgstr ""
msgid ""
"You can provide your contact information here to allow others to contact "
"you. Please note that this information will be visible <em>publicly</em> on "
"the internet together with your node's coordinates."
msgstr ""
msgid "e.g. E-mail or phone number"
msgstr ""
include $(TOPDIR)/rules.mk
PKG_NAME:=ffnw-config-mode-geo-location
PKG_VERSION:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(GLUONDIR)/include/package.mk
PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG)
define Package/ffnw-config-mode-geo-location
SECTION:=config-mode
CATEGORY:=Freifunk Nordwest
TITLE:=Set geographic location of a node
DEPENDS:=gluon-config-mode-core-virtual +ffnw-node-info +lwtrace +libwlocate
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
$(call GluonBuildI18N,ffnw-config-mode-geo-location,i18n)
endef
define Package/ffnw-config-mode-geo-location/install
$(CP) ./files/* $(1)/
$(call GluonInstallI18N,ffnw-config-mode-geo-location,$(1))
endef
$(eval $(call BuildPackage,ffnw-config-mode-geo-location))
local cbi = require "luci.cbi"
local i18n = require "luci.i18n"
local uci = luci.model.uci.cursor()
local M = {}
function M.section(form)
local s = form:section(cbi.SimpleSection, nil, i18n.translate(
'If you want the location of your node to be displayed on the map, '
.. 'you can set an automatically localization of your router or enter its coordinates here. Specifying the altitude '
.. 'is optional and should only be done if a proper value is known.'))
local o
o = s:option(cbi.Flag, "_autolocation", i18n.translate("Enable automatic localization via wifi"))
o.default = uci:get_first("gluon-node-info", "location", "auto_location", o.disabled)
o.rmempty = false
o = s:option(cbi.Value, "_interval", i18n.translate("Interval in minutes"))
o.value = uci:get_first("gluon-node-info", "location", "refresh_interval")
o:depends("_autolocation", "1")
o.rmempty = false
o.datatype = "integer"
o.description = i18n.translatef("Set refresh interval, the default is once per day")
o = s:option(cbi.Flag, "_staticlocation", i18n.translate("Set location manually"))
o.default = uci:get_first("gluon-node-info", "location", "static_location", o.disabled)
o.rmempty = false
o = s:option(cbi.Value, "_latitude", i18n.translate("Latitude"))
o.default = uci:get_first("gluon-node-info", "location", "latitude")
o:depends("_staticlocation", "1")
o.rmempty = false
o.datatype = "float"
o.description = i18n.translatef("e.g. %s", "53.873621")
o = s:option(cbi.Value, "_longitude", i18n.translate("Longitude"))
o.default = uci:get_first("gluon-node-info", "location", "longitude")
o:depends("_staticlocation", "1")
o.rmempty = false
o.datatype = "float"
o.description = i18n.translatef("e.g. %s", "10.689901")
o = s:option(cbi.Value, "_altitude", i18n.translate("Altitude"))
o.default = uci:get_first("gluon-node-info", "location", "altitude")
o:depends("_staticlocation", "1")
o.rmempty = true
o.datatype = "float"
o.description = i18n.translatef("e.g. %s", "11.51")
end
function M.handle(data)
local sname = uci:get_first("gluon-node-info", "location")
uci:set("gluon-node-info", sname, "auto_location", data._autolocation)
uci:set("gluon-node-info", sname, "static_location", data._staticlocation)
if tonumber(data._autolocation) == 1 then
if data._interval ~= nil and tonumber(data._interval) >= 1 and tonumber(data._interval) <= 43200 then
uci:set("gluon-node-info", sname, "refresh_interval", data._interval)
elseif tonumber(data._interval) > 43200 then
uci:set("gluon-node-info", sname, "refresh_interval", 43200)
end
end
if tonumber(data._staticlocation) == 1 and data._latitude ~= nil and data._longitude ~= nil then
uci:set("gluon-node-info", sname, "share_location", data._staticlocation)
uci:set("gluon-node-info", sname, "latitude", data._latitude)
uci:set("gluon-node-info", sname, "longitude", data._longitude)
if data._altitude ~= nil then
uci:set("gluon-node-info", sname, "altitude", data._altitude)
else
uci:delete("gluon-node-info", sname, "altitude")
end
else
uci:set("gluon-node-info", sname, "share_location", data._staticlocation)
end
uci:save("gluon-node-info")
uci:commit("gluon-node-info")
end
return M
msgid ""
msgstr ""
"Project-Id-Version: ffnw-config-mode-geo-location\n"
"PO-Revision-Date: 2015-07-13 02:18+0100\n"
"Last-Translator: Jan-Tarek Butt <tarek@ring0.de>\n"
"Language-Team: German\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid ""
"If you want the location of your node to be displayed on the map, you can set an automatically localization of your router or "
"enter its coordinates here. Specifying the altitude is optional and should "
"only be done if a proper value is known."
msgstr ""
"Um deinen Knoten auf der Karte anzeigen zu können, benötigen wir seine "
"Koordinaten. Hier hast du die Möglichkeit, diese zu hinterlegen oder dies Automatisch bestimmen zu lassen. Die "
"Höhenangabe ist optional und sollte nur gesetzt werden, wenn ein exakter "
"Wert bekannt ist."
msgid "Enable automatic localization via wifi"
msgstr "Automatische Positions bestimmung via WLAN"
msgid "Interval in minutes"
msgstr "Intervall in Minuten"
msgid "Set refresh interval, the default is once per day"
msgstr "Setze einen Intervall. Der standard Intervall ist einmal täglich"
msgid "Set location manually"
msgstr "Setze die Position Manuell"
msgid "Latitude"
msgstr "Breitengrad"
msgid "Longitude"
msgstr "Längengrad"
msgid "Altitude"
msgstr "Höhenmeter über Normalnull"
msgid "e.g. %s"
msgstr "z.B. %s"
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
msgid ""
"If you want the location of your node to be displayed on the map, you can set an automatically localization of your router or "
"enter its coordinates here. Specifying the altitude is optional and should "
"only be done if a proper value is known."
msgstr ""
msgid "Enable automatic localization via wifi"
msgstr ""
msgid "Interval in minutes"
msgstr ""
msgid "Set refresh interval, the default is once per day"
msgstr ""
msgid "Set location manually"
msgstr ""
msgid "Latitude"
msgstr ""
msgid "Longitude"
msgstr ""
msgid "Altitude"
msgstr ""
msgid "e.g. %s"
msgstr ""
include $(TOPDIR)/rules.mk
PKG_NAME:=ffnw-node-info
PKG_VERSION:=1
PKG_RELEASE:=1
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/ffnw-node-info
SECTION:=daemon
CATEGORY:=Freifunk Nordwest
TITLE:=Sed node infos for alfred
DEPENDS:=+lwtrace +libwlocate +gluon-core
endef
define Package/ffnw-node-info/description
Sed node infos for alfred
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/ffnw-node-info/install
$(CP) ./files/* $(1)/
endef
define Package/ffnw-node-info/postinst
#!/bin/sh
$(call GluonCheckSite,check_site.lua)
endef
$(eval $(call BuildPackage,ffnw-node-info))
need_string('roles.default', false)
need_number('location.autolocation', false)
need_number('location.interval', false)
=== ffnw-node-info ===
The package ffnw-node-info is a combination gif informations about the router. The main function of this package is to get or sed geocoordinations (latditude and longditude) This Package has also an another major feature its is able to triangulate the router location via wifi.
=== Parameters discription ===
auto_location [0|1] set lwtrace for wifi localisation disable or enable
refresh_interval [val] set the minutly interval to run the triangulation over wifi
static_location [0|1] set router position automaticly or not