mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-04-29 10:10:19 +00:00
Make module manager work for any available modules.
This commit is contained in:
parent
7c6f1e72fa
commit
411785eb3f
@ -18,16 +18,34 @@ class Packages(PagePlugin, FormPlugin):
|
|||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
@require()
|
@require()
|
||||||
def index(self, *args, **kwargs):
|
def index(self, *args, **kwargs):
|
||||||
output, error = '', ''
|
output, error = actions.run("module-list-available")
|
||||||
if 'submitted' in kwargs:
|
if error:
|
||||||
if 'owncloud_enable' in kwargs:
|
raise Exception("something is wrong: " + error)
|
||||||
output, error = actions.superuser_run("module-enable", [cfg.python_root, "owncloud"])
|
modules_available = output.split()
|
||||||
# TODO: need to get plinth to load the module we just enabled
|
|
||||||
else:
|
output, error = actions.run("module-list-enabled", cfg.python_root)
|
||||||
output, error = actions.superuser_run("module-disable", [cfg.python_root, "owncloud"])
|
if error:
|
||||||
# TODO: need a smoother way for plinth to unload the module
|
raise Exception("something is wrong: " + error)
|
||||||
|
modules_enabled = output.split()
|
||||||
|
|
||||||
main=_("""
|
if 'submitted' in kwargs:
|
||||||
|
del kwargs['submitted']
|
||||||
|
modules_selected = map(lambda x: x.split("_")[0], kwargs.keys())
|
||||||
|
for module in modules_available:
|
||||||
|
if module in modules_enabled:
|
||||||
|
if module not in modules_selected:
|
||||||
|
output, error = actions.superuser_run(\
|
||||||
|
"module-disable", [cfg.python_root, module])
|
||||||
|
# TODO: need a smoother way for plinth
|
||||||
|
# to unload the module
|
||||||
|
else:
|
||||||
|
if module in modules_selected:
|
||||||
|
output, error = actions.superuser_run(\
|
||||||
|
"module-enable", [cfg.python_root, module])
|
||||||
|
# TODO: need to get plinth to load
|
||||||
|
# the module we just enabled
|
||||||
|
|
||||||
|
main = _("""
|
||||||
<p>aptitude purge modules</p>
|
<p>aptitude purge modules</p>
|
||||||
<p>aptitude install modules</p>
|
<p>aptitude install modules</p>
|
||||||
<p>The modules should depend on the appropriate Debian packages.</p>""")
|
<p>The modules should depend on the appropriate Debian packages.</p>""")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user