Use package framework for installing pagekite

This commit is contained in:
Sunil Mohan Adapa 2014-12-22 23:29:15 +05:30
parent d79f346591
commit 7b45ad1813
3 changed files with 2 additions and 28 deletions

View File

@ -48,10 +48,6 @@ def parse_arguments():
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers(dest='subcommand', help='Sub command')
# Get installed status
subparsers.add_parser('get-installed',
help='Get whether PakeKite is installed')
# Start PageKite
subparsers.add_parser('start', help='Start PageKite service')
@ -91,14 +87,6 @@ def parse_arguments():
return parser.parse_args()
def subcommand_get_installed(_):
"""Print whether PageKite is installed"""
with open('/dev/null', 'w') as file_handle:
status = subprocess.call(['which', 'pagekite'], stdout=file_handle)
print('installed' if not status else 'not installed')
def subcommand_start(_):
"""Start PageKite service"""
status = subprocess.call(['service', 'pagekite', 'start'])

View File

@ -30,6 +30,7 @@ import logging
from plinth import actions
from plinth import cfg
from plinth import package
LOGGER = logging.getLogger(__name__)
@ -101,6 +102,7 @@ https://pagekite.net/wiki/Howto/SshOverPageKite/">instructions</a>'))
@login_required
@package.required('pagekite')
def configure(request):
"""Serve the configuration form"""
status = get_status()
@ -131,11 +133,6 @@ def get_status():
"""
status = {}
# Check if PageKite is installed
output = _run(['get-installed'])
if output.split()[0] != 'installed':
return None
# PageKite service enabled/disabled
output = _run(['get-status'])
status['enabled'] = (output.split()[0] == 'enabled')

View File

@ -22,15 +22,6 @@
{% block content %}
{% if not status %}
<p>PageKite is not installed, please install it. PageKite comes
pre-installed with {{ cfg.box_name }}. On any Debian based system
(such as {{ cfg.box_name }}) you may install it using the command
<code>aptitude install pagekite<code></p>
{% else %}
<form class="form" method="post">
{% csrf_token %}
@ -52,8 +43,6 @@
</form>
{% endif %}
{% endblock %}
{% block page_js %}