From 7b45ad1813aeea97f8180304618282654274d6ee Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Mon, 22 Dec 2014 23:29:15 +0530 Subject: [PATCH] Use package framework for installing pagekite --- actions/pagekite-configure | 12 ------------ plinth/modules/pagekite/pagekite.py | 7 ++----- .../pagekite/templates/pagekite_configure.html | 11 ----------- 3 files changed, 2 insertions(+), 28 deletions(-) diff --git a/actions/pagekite-configure b/actions/pagekite-configure index 8a22142a5..a5af96fb0 100755 --- a/actions/pagekite-configure +++ b/actions/pagekite-configure @@ -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']) diff --git a/plinth/modules/pagekite/pagekite.py b/plinth/modules/pagekite/pagekite.py index 9f435b77e..519a7b0fd 100644 --- a/plinth/modules/pagekite/pagekite.py +++ b/plinth/modules/pagekite/pagekite.py @@ -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')) @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') diff --git a/plinth/modules/pagekite/templates/pagekite_configure.html b/plinth/modules/pagekite/templates/pagekite_configure.html index e41436a56..0d737ba9b 100644 --- a/plinth/modules/pagekite/templates/pagekite_configure.html +++ b/plinth/modules/pagekite/templates/pagekite_configure.html @@ -22,15 +22,6 @@ {% block content %} -{% if not status %} - -

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 - aptitude install pagekite

- -{% else %} -
{% csrf_token %} @@ -52,8 +43,6 @@
-{% endif %} - {% endblock %} {% block page_js %}