deluge: Install apache conf file during Plinth install.

This commit is contained in:
James Valleroy 2015-06-07 12:56:39 -04:00 committed by Sunil Mohan Adapa
parent 9d6ceaa0ff
commit 9c717246ee
2 changed files with 10 additions and 20 deletions

View File

@ -26,19 +26,7 @@ import os
import subprocess
APACHE_CONF_PATH = '/etc/apache2/conf-available/deluge-web.conf'
APACHE_CONF_ENABLED_PATH = '/etc/apache2/conf-enabled/deluge-web.conf'
APACHE_CONF = '''
##
## On all sites, provide Deluge on a default path: /deluge
##
## This file is managed and overwritten by Plinth. If you wish to edit
## it, disable Deluge in Plinth, remove this file and manage it manually.
##
<Location /deluge>
ProxyPass http://localhost:8112
</Location>
'''
APACHE_CONF_ENABLED_PATH = '/etc/apache2/conf-enabled/deluge-plinth.conf'
SYSTEMD_SERVICE_PATH = '/etc/systemd/system/deluge-web.service'
SYSTEMD_SERVICE = '''
@ -98,13 +86,13 @@ def subcommand_enable(_):
setup()
start()
subprocess.check_call(['a2enconf', 'deluge-web'])
subprocess.check_call(['a2enconf', 'deluge-plinth'])
subprocess.check_call(['service', 'apache2', 'reload'])
def subcommand_disable(_):
"""Disable deluge-web site and stop deluge-web."""
subprocess.check_call(['a2disconf', 'deluge-web'])
subprocess.check_call(['a2disconf', 'deluge-plinth'])
subprocess.check_call(['service', 'apache2', 'reload'])
stop()
@ -140,11 +128,7 @@ def stop():
def setup():
"""Perform initial setup for deluge-web site."""
if not os.path.isfile(APACHE_CONF_PATH):
with open(APACHE_CONF_PATH, 'w') as conffile:
conffile.write(APACHE_CONF)
"""Perform initial setup for deluge-web."""
if not os.path.isfile(SYSTEMD_SERVICE_PATH):
with open(SYSTEMD_SERVICE_PATH, 'w') as file_handle:
file_handle.write(SYSTEMD_SERVICE)

View File

@ -0,0 +1,6 @@
##
## On all sites, provide Deluge on a default path: /deluge
##
<Location /deluge>
ProxyPass http://localhost:8112
</Location>