diff --git a/actions/upgrades b/actions/upgrades index 83524846a..d37297498 100755 --- a/actions/upgrades +++ b/actions/upgrades @@ -83,12 +83,12 @@ def parse_arguments(): def subcommand_run(_): """Run unattended-upgrades""" try: - subprocess.Popen(['unattended-upgrades', '-v'], + subprocess.Popen(['systemctl', 'start', 'freedombox-manual-upgrade'], stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, close_fds=True, start_new_session=True) except FileNotFoundError: - print('Error: unattended-upgrades is not available.', file=sys.stderr) + print('Error: systemctl is not available.', file=sys.stderr) sys.exit(2) except Exception as error: print('Error: {0}'.format(error), file=sys.stderr) diff --git a/debian/rules b/debian/rules index ac00ed40f..b0a3a6f76 100755 --- a/debian/rules +++ b/debian/rules @@ -14,3 +14,7 @@ override_dh_auto_install-indep: override_dh_auto_test: PYBUILD_SYSTEM=custom \ PYBUILD_TEST_ARGS="{interpreter} setup.py test" dh_auto_test + +override_dh_installsystemd: + # Do not enable or start freedombox-manual-upgrade.service. + dh_installsystemd --exclude=freedombox-manual-upgrade.service diff --git a/plinth/modules/upgrades/data/etc/needrestart/conf.d/freedombox.conf b/plinth/modules/upgrades/data/etc/needrestart/conf.d/freedombox.conf index a1853d350..34a811b7c 100644 --- a/plinth/modules/upgrades/data/etc/needrestart/conf.d/freedombox.conf +++ b/plinth/modules/upgrades/data/etc/needrestart/conf.d/freedombox.conf @@ -1,2 +1,5 @@ # Automatically restart services when needed. $nrconf{restart} = 'a'; + +# Don't restart freedombox-manual-upgrade.service. +$nrconf{override_rc}->{qr(^freedombox-manual-upgrade\.service$)} = 0; diff --git a/plinth/modules/upgrades/data/lib/systemd/system/freedombox-manual-upgrade.service b/plinth/modules/upgrades/data/lib/systemd/system/freedombox-manual-upgrade.service new file mode 100644 index 000000000..862db4196 --- /dev/null +++ b/plinth/modules/upgrades/data/lib/systemd/system/freedombox-manual-upgrade.service @@ -0,0 +1,8 @@ +[Unit] +Description=Run unattended-upgrade once + +[Service] +Type=oneshot +ExecStart=unattended-upgrade --verbose +KillMode=process +TimeoutStopSec=900