From 76cdc69099237c2a5d39e0feaae7de8b255b94f2 Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Mon, 31 Aug 2015 19:24:45 -0400 Subject: [PATCH] upgrades: Enable automatic upgrades after install --- plinth/modules/upgrades/upgrades.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plinth/modules/upgrades/upgrades.py b/plinth/modules/upgrades/upgrades.py index 6a3b3e6b3..1839d3feb 100644 --- a/plinth/modules/upgrades/upgrades.py +++ b/plinth/modules/upgrades/upgrades.py @@ -44,7 +44,12 @@ def init(): 'upgrades:index', 21) -@package.required(['unattended-upgrades']) +def on_install(): + """Enable automatic upgrades after install.""" + actions.superuser_run('upgrades', ['enable-auto']) + + +@package.required(['unattended-upgrades'], on_install=on_install) def index(request): """Serve the index page.""" return TemplateResponse(request, 'upgrades.html', @@ -53,7 +58,7 @@ def index(request): @require_POST -@package.required(['unattended-upgrades']) +@package.required(['unattended-upgrades'], on_install=on_install) def run(request): """Run upgrades and show the output page.""" output = '' @@ -81,7 +86,7 @@ run once per day. It will attempt to perform any package upgrades that are \ available.')) -@package.required(['unattended-upgrades']) +@package.required(['unattended-upgrades'], on_install=on_install) def configure(request): """Serve the configuration form.""" status = get_status()