mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
upgrades: Use a custom service for manual update
- Do not enable/start service during package install/upgrade - Configure needrestart to skip restarting service Closes: #1638. Signed-off-by: James Valleroy <jvalleroy@mailbox.org> [sunil: Provide proper regex string in needrestart configuration with qr()] Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
10617b900e
commit
2d1ced84cd
@ -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)
|
||||
|
||||
4
debian/rules
vendored
4
debian/rules
vendored
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
[Unit]
|
||||
Description=Run unattended-upgrade once
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=unattended-upgrade --verbose
|
||||
KillMode=process
|
||||
TimeoutStopSec=900
|
||||
Loading…
x
Reference in New Issue
Block a user