Repair: restart a running tunnel and torrents, so an upgrade loads their new code (#1040)

repair.sh ends with systemctl start wrolpi.target, which leaves a running
unit as it was. wrolpi-vpn (the root tunnel) and wrolpi-torrent kept the
old code until a reboot, so a tunnel.py fix did not apply after an
upgrade. try-restart restarts them only if they are running.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
lrnselfreliance 2026-11-30 15:06:21 -07:00 • committed by Roland
parent 87ed2ffeb8
commit 5806882f85
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
2 changed files with 12 additions and 0 deletions

View file

@ -674,6 +674,15 @@ class TestInstalled:
'etc/raspberrypios/wrolpi.target'):
assert 'wrolpi-vpn.service' in (REPOSITORY / script).read_text(), script
def test_repair_restarts_a_running_tunnel(self):
"""An upgrade (which ends with repair.sh) must load a new tunnel.py: `systemctl start wrolpi.target` leaves a
running tunnel on the old code. Torrents are restarted with it (they run in its namespace, behind its kill
switch). try-restart: neither is started if it was not running."""
repair = (REPOSITORY / 'repair.sh').read_text()
restart = 'systemctl try-restart wrolpi-vpn.service wrolpi-torrent.service'
assert restart in repair
assert repair.index(restart) < repair.index('systemctl start wrolpi.target')
def test_packages(self):
for packages in ('pi-gen/stage2/04-wrolpi/01-packages-nr',
'debian-live-config/config/package-lists/wrolpi.list.chroot'):

View file

@ -219,6 +219,9 @@ fi
systemctl restart wrolpi-help
# Restarted, not only started: its config may have changed.
systemctl restart wrolpi-rsyncd || :
# A running tunnel (and torrents, in its namespace) must load the new code; starting wrolpi.target leaves it as it
# was. Only if running: a stopped VPN stays stopped.
systemctl try-restart wrolpi-vpn.service wrolpi-torrent.service || :
systemctl start wrolpi.target
set +x