diff --git a/actions/pagekite b/actions/pagekite index 9c5cd2a07..afd612bbd 100755 --- a/actions/pagekite +++ b/actions/pagekite @@ -52,6 +52,9 @@ def parse_arguments(): subparsers.add_parser('start-and-enable', help='Enable PageKite service') subparsers.add_parser('stop-and-disable', help='Disable PageKite service') subparsers.add_parser('restart', help='Restart PageKite service') + subparsers.add_parser('is-disabled', + help=('Wether PageKite is disabled in the file ' + '/etc/pagekite.d/10_accounts.rc')) # Frontend subparsers.add_parser('get-frontend', help='Get pagekite frontend') @@ -86,6 +89,13 @@ def subcommand_restart(_): print('restarted') +def subcommand_is_disabled(_): + if aug.match(PATHS['abort_not_configured']): + print('true') + else: + print('false') + + def subcommand_start_and_enable(_): aug.remove(PATHS['abort_not_configured']) aug.save() diff --git a/plinth/modules/pagekite/utils.py b/plinth/modules/pagekite/utils.py index c55b81946..4d8a17af6 100644 --- a/plinth/modules/pagekite/utils.py +++ b/plinth/modules/pagekite/utils.py @@ -91,8 +91,12 @@ def get_pagekite_config(): status = {} # PageKite service enabled/disabled - # This assumes that if pagekite is running it's also enabled as a service - status['enabled'] = action_utils.service_is_running('pagekite') + # To enable PageKite two things are necessary: + # 1) pagekite not being disabled in /etc/pagekite.d/10_account.rc + # 2) the pagekite service running + is_disabled = run(['is-disabled']).strip()=='true' + service_running = action_utils.service_is_running('pagekite') + status['enabled'] = service_running and not is_disabled # PageKite kite details status.update(get_kite_details())