mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-02-18 08:33:41 +00:00
deluge: Run setup and enable after install.
This commit is contained in:
parent
9c717246ee
commit
fd73bcd734
@ -55,6 +55,9 @@ def parse_arguments():
|
||||
parser = argparse.ArgumentParser()
|
||||
subparsers = parser.add_subparsers(dest='subcommand', help='Sub command')
|
||||
|
||||
# Setup deluge-web
|
||||
subparsers.add_parser('setup', help='Perform first time setup operations.')
|
||||
|
||||
# Get whether deluge-web site is enabled
|
||||
subparsers.add_parser('get-enabled',
|
||||
help='Get whether deluge-web site is enabled')
|
||||
@ -72,6 +75,14 @@ def parse_arguments():
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def subcommand_setup(_):
|
||||
"""Perform first time setup operations."""
|
||||
setup()
|
||||
start()
|
||||
subprocess.check_call(['a2enconf', 'deluge-plinth'])
|
||||
subprocess.check_call(['service', 'apache2', 'reload'])
|
||||
|
||||
|
||||
def subcommand_get_enabled(_):
|
||||
"""Get whether deluge-web site is enabled."""
|
||||
if os.path.isfile(APACHE_CONF_ENABLED_PATH) and \
|
||||
@ -83,8 +94,6 @@ def subcommand_get_enabled(_):
|
||||
|
||||
def subcommand_enable(_):
|
||||
"""Enable deluge-web site and start deluge-web."""
|
||||
setup()
|
||||
|
||||
start()
|
||||
subprocess.check_call(['a2enconf', 'deluge-plinth'])
|
||||
subprocess.check_call(['service', 'apache2', 'reload'])
|
||||
|
||||
@ -29,8 +29,13 @@ from plinth import actions
|
||||
from plinth import package
|
||||
|
||||
|
||||
def on_install():
|
||||
"""Setup deluge-web on install."""
|
||||
actions.superuser_run('deluge', ['setup'])
|
||||
|
||||
|
||||
@login_required
|
||||
@package.required(['deluged', 'deluge-web'])
|
||||
@package.required(['deluged', 'deluge-web'], on_install=on_install)
|
||||
def index(request):
|
||||
"""Serve configuration page."""
|
||||
status = get_status()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user