From 6203d55284234076acd97e48971ab167edd775b1 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 1 Sep 2008 23:04:38 +0000 Subject: [PATCH] * luci/applications: olsr: remove init stuff, moved to olsrd-luci --- applications/luci-olsr/root/etc/config/olsr | 42 ----- applications/luci-olsr/root/etc/init.d/olsrd | 37 ----- .../luci-olsr/root/lib/config/olsr.lua | 153 ------------------ 3 files changed, 232 deletions(-) delete mode 100644 applications/luci-olsr/root/etc/config/olsr delete mode 100755 applications/luci-olsr/root/etc/init.d/olsrd delete mode 100644 applications/luci-olsr/root/lib/config/olsr.lua diff --git a/applications/luci-olsr/root/etc/config/olsr b/applications/luci-olsr/root/etc/config/olsr deleted file mode 100644 index a1fe65aa7..000000000 --- a/applications/luci-olsr/root/etc/config/olsr +++ /dev/null @@ -1,42 +0,0 @@ -config 'olsr' 'general' - option 'DebugLevel' '0' - option 'IpVersion' '4' - option 'AllowNoInt' 'yes' - option 'Pollrate' '0.025' - option 'TcRedundancy' '2' - option 'MprCoverage' '7' - option 'LinkQualityFishEye' '1' - option 'LinkQualityWinSize' '100' - option 'LinkQualityDijkstraLimit' '0 9.0' - option 'LinkQualityLevel' '2' - option 'UseHysteresis' 'no' - -config 'LoadPlugin' 'dyn_gw' - option 'Library' 'olsrd_dyn_gw.so.0.4' - -config 'LoadPlugin' 'nameservice' - option 'Library' 'olsrd_nameservice.so.0.3' - option 'suffix' '.olsr' - option 'latlon_infile' '/tmp/latlon.txt' - option 'hosts_file' '/var/etc/hosts' - option 'name' 'luci-node' - -config 'LoadPlugin' 'txtinfo' - option 'Library' 'olsrd_txtinfo.so.0.1' - option 'Accept' '127.0.0.1' - -config 'Interface' - option 'HelloInterval' '6.0' - option 'MidValidityTime' '324.0' - option 'TcInterval' '4.0' - option 'HnaValidityTime' '108.0' - option 'HelloValidityTime' '108.0' - option 'TcValidityTime' '324.0' - option 'HnaInterval' '18.0' - option 'MidInterval' '18.0' - option 'Interface' 'br-ff' - -config 'ipc' 'IpcConnect' - option 'MaxConnections' '0' - option 'Host' '127.0.0.1 10.0.0.5' - option 'Net' '192.168.1.0 255.255.255.0 10.0.0.0 255.0.0.0' diff --git a/applications/luci-olsr/root/etc/init.d/olsrd b/applications/luci-olsr/root/etc/init.d/olsrd deleted file mode 100755 index 04c3a7578..000000000 --- a/applications/luci-olsr/root/etc/init.d/olsrd +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh /etc/rc.common -START=50 - -BIN=/usr/sbin/olsrd -CONF=/var/etc/olsrd.conf -DEFAULT=/etc/default/olsrd -PID=/var/run/olsrd.pid - -start() { - ### load defaults - [ -f $DEFAULT ] && . $DEFAULT - - ### generate config - mkdir -p ${CONF%/*} - lua /lib/config/olsr.lua > $CONF - - ### check for running instance (start-stop-daemon is too stupid to do this) - if [ -s $PID ]; then - if kill -0 $(cat $PID) 2>&-; then - echo "there is already a running instance ($(cat $PID))" - exit 1 - fi - fi - - ### start olsrd - start-stop-daemon -b -m -p $PID -x $BIN -S -- -f $CONF -nofork $OPTIONS -} - -stop() { - ### stop olsrd - start-stop-daemon -q -p $PID -a ${BIN##*/} -K -} - -restart() { - ### override generic restart because we need some time between stop and start - stop; sleep 3; start -} diff --git a/applications/luci-olsr/root/lib/config/olsr.lua b/applications/luci-olsr/root/lib/config/olsr.lua deleted file mode 100644 index 0482310f9..000000000 --- a/applications/luci-olsr/root/lib/config/olsr.lua +++ /dev/null @@ -1,153 +0,0 @@ -#!/usr/bin/lua - ---[[ - -OLSRd configuration generator -(c) 2008 Freifunk Leipzig / Jo-Philipp Wich - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id: olsr.lua 2516 2008-07-06 13:34:07Z jow $ - -]]-- - -require("luci.util") -require("luci.model.uci") - -luci.model.uci.load_state("network") -local conf = luci.model.uci.get_all("olsr") - -local function _value(val) - if val:match("^[0-9%. \t]+$") or val == "yes" or val == "no" then - return val - else - return string.format( '"%s"', val ) - end -end - -local function _section(sect,sval,parstr) - local rv = "" - local pad = "" - - if sval then - local val = "" - - if sval == "Interface" then - val = luci.model.uci.get( "network", conf[sect][sval], "ifname" ) - else - val = conf[sect][sval] - end - - rv = string.format( '%s "%s"\n{\n', conf[sect][".type"], val ) - pad = "\t" - end - - for k, v in luci.util.spairs(conf[sect]) do - if k:sub(1,1) ~= '.' and k ~= sval then - if parstr then - rv = rv .. string.format( - '%s%s "%s"\t"%s"\n', - pad, parstr, - k:gsub( "_", "-" ), -- XXX: find a better solution for this - v - ) - else - rv = rv .. string.format( - '%s%s\t%s\n', - pad, k, _value(v) - ) - end - end - end - - if sval then - rv = rv .. "}\n" - end - - return rv -end - -local function _hna(sval) - local rv = string.format( "%s\n{\n", sval ) - local cnt = 0 - - for k, v in luci.util.spairs(conf) do - if conf[k][".type"] == sval and conf[k].NetAddr and conf[k].Prefix then - cnt = cnt + 1 - rv = rv .. string.format( - "\t%s\t%s\n", - conf[k].NetAddr, - conf[k].Prefix - ) - end - end - - return ( cnt > 0 and rv .. "}\n" or "" ) -end - -local function _ipc(sval) - if conf[sval] and ( conf[sval].MaxConnections == nil or tonumber(conf[sval].MaxConnections) > 0 ) then - local rv = string.format( "%s\n{\n", sval ) - - for k, v in luci.util.spairs(conf[sval]) do - if k:sub(1,1) ~= "." then - local vals = luci.util.split(v, "%s+", nil, true) - - if k == "Net" then - for i = 1,#vals,2 do - rv = rv .. string.format( - "\tNet\t%s\t%s\n", - vals[i], vals[i+1] - ) - end - elseif k == "Host" then - for i, v in ipairs(vals) do - rv = rv .. string.format( - "\t%s\t%s\n", - k, vals[i] - ) - end - else - rv = rv .. string.format( - "\t%s\t%s\n", - k, v - ) - end - end - end - - return rv .. "}\n" - else - return "" - end -end - - --- general config section -print( _section("general") ) - --- plugin config sections -for k, v in luci.util.spairs(conf) do - if conf[k][".type"] == "LoadPlugin" then - print( _section( k, "Library", "PlParam" ) ) - end -end - --- interface config sections -for k, v in luci.util.spairs(conf) do - if conf[k][".type"] == "Interface" then - print( _section( k, "Interface" ) ) - end -end - --- write Hna4, Hna6 sections -print( _hna("Hna4") ) -print( _hna("Hna6") ) - --- write IpcConnect section -print( _ipc("IpcConnect") ) - -- 2.25.1