mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +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()
|
parser = argparse.ArgumentParser()
|
||||||
subparsers = parser.add_subparsers(dest='subcommand', help='Sub command')
|
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
|
# Get whether deluge-web site is enabled
|
||||||
subparsers.add_parser('get-enabled',
|
subparsers.add_parser('get-enabled',
|
||||||
help='Get whether deluge-web site is enabled')
|
help='Get whether deluge-web site is enabled')
|
||||||
@ -72,6 +75,14 @@ def parse_arguments():
|
|||||||
return parser.parse_args()
|
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(_):
|
def subcommand_get_enabled(_):
|
||||||
"""Get whether deluge-web site is enabled."""
|
"""Get whether deluge-web site is enabled."""
|
||||||
if os.path.isfile(APACHE_CONF_ENABLED_PATH) and \
|
if os.path.isfile(APACHE_CONF_ENABLED_PATH) and \
|
||||||
@ -83,8 +94,6 @@ def subcommand_get_enabled(_):
|
|||||||
|
|
||||||
def subcommand_enable(_):
|
def subcommand_enable(_):
|
||||||
"""Enable deluge-web site and start deluge-web."""
|
"""Enable deluge-web site and start deluge-web."""
|
||||||
setup()
|
|
||||||
|
|
||||||
start()
|
start()
|
||||||
subprocess.check_call(['a2enconf', 'deluge-plinth'])
|
subprocess.check_call(['a2enconf', 'deluge-plinth'])
|
||||||
subprocess.check_call(['service', 'apache2', 'reload'])
|
subprocess.check_call(['service', 'apache2', 'reload'])
|
||||||
|
|||||||
@ -29,8 +29,13 @@ from plinth import actions
|
|||||||
from plinth import package
|
from plinth import package
|
||||||
|
|
||||||
|
|
||||||
|
def on_install():
|
||||||
|
"""Setup deluge-web on install."""
|
||||||
|
actions.superuser_run('deluge', ['setup'])
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@package.required(['deluged', 'deluge-web'])
|
@package.required(['deluged', 'deluge-web'], on_install=on_install)
|
||||||
def index(request):
|
def index(request):
|
||||||
"""Serve configuration page."""
|
"""Serve configuration page."""
|
||||||
status = get_status()
|
status = get_status()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user