--- /dev/null
+include ../../build/config.mk
+include ../../build/module.mk
\ No newline at end of file
--- /dev/null
+--[[
+LuCI - Lua Configuration Interface
+
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+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$
+]]--
+module("luci.controller.init", package.seeall)
+
+function index()
+ if not luci.fs.isfile("/etc/rc.common") then
+ return
+ end
+
+ require("luci.i18n")
+ luci.i18n.loadc("initmgr")
+
+ entry(
+ {"admin", "system", "init"}, form("init/init"),
+ luci.i18n.translate("initmgr", "Init Scripts")
+ ).i18n = "initmgr"
+end
--- /dev/null
+initmgr = 'Startscripte'
+initmgr_desc = 'Hier können installierte Startscripte aktiviert oder deaktiviert werden. Änderungen werden erst mit einem Geräteneustart angewendet.<br /><strong>Warnung: Wenn essentialle Startscripte wie "network" deaktiviert werden könnte das Gerät unerreichbar werden!</strong>'
+initmgr_index = 'Startpriorität'
+initmgr_name = 'Startscript'
+initmgr_enabled = 'Aktivieren/Deaktivieren'
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+
+<i18n:msgs xmlns:i18n="http://luci.freifunk-halle.net/2008/i18n#" xmlns="http://www.w3.org/1999/xhtml">
+
+<i18n:msg xml:id="initmgr">Startscripte</i18n:msg>
+<i18n:msg xml:id="initmgr_desc">Hier können installierte Startscripte aktiviert oder deaktiviert werden. Änderungen werden erst mit einem Geräteneustart angewendet.<br /><strong>Warnung: Wenn essentialle Startscripte wie "network" deaktiviert werden könnte das Gerät unerreichbar werden!</strong></i18n:msg>
+<i18n:msg xml:id="initmgr_index">Startpriorität</i18n:msg>
+<i18n:msg xml:id="initmgr_name">Startscript</i18n:msg>
+<i18n:msg xml:id="initmgr_enabled">Aktivieren/Deaktivieren</i18n:msg>
+
+</i18n:msgs>
--- /dev/null
+initmgr = 'Initscripts'
+initmgr_desc = 'You can enable or disable installed init scripts here. Changes will applied after a device reboot.<br /><strong>Warning: If you disable essential init scripts like "network", your device might become inaccesable!</strong>'
+initmgr_index = 'Start priority'
+initmgr_name = 'Initscript'
+initmgr_enabled = 'Enable/Disable'
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+
+<i18n:msgs xmlns:i18n="http://luci.freifunk-halle.net/2008/i18n#" xmlns="http://www.w3.org/1999/xhtml">
+
+<i18n:msg xml:id="initmgr">Initscripts</i18n:msg>
+<i18n:msg xml:id="initmgr_desc">You can enable or disable installed init scripts here. Changes will applied after a device reboot.<br /><strong>Warning: If you disable essential init scripts like "network", your device might become inaccesable!</strong></i18n:msg>
+<i18n:msg xml:id="initmgr_index">Start priority</i18n:msg>
+<i18n:msg xml:id="initmgr_name">Initscript</i18n:msg>
+<i18n:msg xml:id="initmgr_enabled">Enable/Disable</i18n:msg>
+
+</i18n:msgs>
--- /dev/null
+initmgr = 'Scripts de Inicialização'
+initmgr_desc = 'Você pode ativar ou desativar os scripts de inicialização instalados aqui. As mudanças serão aplicadas após a reinicialização do equipamento.<br /><strong>Aviso: Se você desativar algum script de inicialização essencial "rede/network", o dispositivo poderá tornar-se inacessível!</strong>'
+initmgr_index = 'Prioridade de inicialização'
+initmgr_name = 'Script de inicialização'
+initmgr_enabled = 'Ativar/Desativar'
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+
+<i18n:msgs xmlns:i18n="http://luci.freifunk-halle.net/2008/i18n#" xmlns="http://www.w3.org/1999/xhtml">
+
+<i18n:msg xml:id="initmgr">Scripts de Inicialização</i18n:msg>
+<i18n:msg xml:id="initmgr_desc">Você pode ativar ou desativar os scripts de inicialização instalados aqui. As mudanças serão aplicadas após a reinicialização do equipamento.<br /><strong>Aviso: Se você desativar algum script de inicialização essencial como por exemplo "rede/network", o dispositivo poderá tornar-se inacessível!</strong></i18n:msg>
+<i18n:msg xml:id="initmgr_index">Prioridade de inicialização</i18n:msg>
+<i18n:msg xml:id="initmgr_name">Script de inicialização</i18n:msg>
+<i18n:msg xml:id="initmgr_enabled">Ativar/Desativar</i18n:msg>
+
+</i18n:msgs>
--- /dev/null
+--[[
+LuCI - Lua Configuration Interface
+
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+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$
+]]--
+
+require("luci.sys")
+require("luci.util")
+
+local inits = { }
+
+for _, name in ipairs(luci.sys.init.names()) do
+ local index = luci.sys.init.index(name)
+ local enabled = luci.sys.init.enabled(name)
+
+ inits["%02i.%s" % { index, name }] = {
+ name = name,
+ index = tostring(index),
+ enabled = enabled
+ }
+end
+
+
+m = SimpleForm("initmgr", translate("initmgr"), translate("initmgr_desc"))
+m.reset = false
+
+s = m:section(Table, inits)
+
+i = s:option(DummyValue, "index", translate("initmgr_index"))
+n = s:option(DummyValue, "name", translate("initmgr_name"))
+
+e = s:option(Flag, "enabled", translate("initmgr_enabled"))
+
+e.cfgvalue = function(self, section)
+ return inits[section].enabled and "1" or "0"
+end
+
+e.write = function(self, section, value)
+ if value == "1" and not inits[section].enabled then
+ inits[section].enabled = true
+ return luci.sys.init.enable(inits[section].name)
+ elseif value == "0" and inits[section].enabled then
+ inits[section].enabled = false
+ return luci.sys.init.disable(inits[section].name)
+ end
+ return true
+end
+
+return m
$(call Package/luci/install/template,$(1),applications/luci-tinyproxy)
endef
+define Package/luci-app-initmgr
+ $(call Package/luci/webtemplate)
+ DEPENDS+=+luci-admin-full
+ TITLE:=LuCI Initscript Management
+endef
+
+define Package/luci-app-initmgr/install
+ $(call Package/luci/install/template,$(1),applications/luci-initmgr)
+endef
+
### Server Gateway Interfaces ###
ifneq ($(CONFIG_PACKAGE_luci-app-tinyproxy),)
PKG_SELECTED_MODULES+=applications/luci-tinyproxy
endif
+ifneq ($(CONFIG_PACKAGE_luci-app-initmgr),)
+ PKG_SELECTED_MODULES+=applications/luci-initmgr
+endif
ifneq ($(CONFIG_PACKAGE_luci-sgi-cgi),)
$(eval $(call BuildPackage,luci-app-ushare))
$(eval $(call BuildPackage,luci-app-hd_idle))
$(eval $(call BuildPackage,luci-app-tinyproxy))
+$(eval $(call BuildPackage,luci-app-initmgr))
$(eval $(call BuildPackage,luci-sgi-cgi))
-- @return Numeric index value
function init.index(name)
if luci.fs.access(init.dir..name) then
- return call("source "..init.dir..name.." && exit $START")
+ return call("source "..init.dir..name.."; exit $START")
end
end
-- @return Boolean indicating success
function init.enable(name)
if luci.fs.access(init.dir..name) then
- return ( call(init.dir..name.." enable") == 0 )
+ return ( call(init.dir..name.." enable") == 1 )
end
end