Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

installer: add a naive systemd service state backup and restore #278

Merged
merged 2 commits into from
Feb 6, 2025

Conversation

KanjiMonster
Copy link
Contributor

Add support for backing up and restoring explicitly disabled and enabled
services by checking their symlinks and restoring or removing them when
applying the backup.

It does naive enabled/disabled services heuristic:

  • if the .preset does not say enabled, and there is a symlink in
    multi-user.target.wants, recreate the symink on restore
  • if the .preset says enabled, and there was no symlink in
    multi-user.target.wants, remove the symlink on restore

Additionally, it only checks certain services:

  • Skip any oneshot services (these are expected to be disabled with
    enabled preset after first boot)
  • Skip any services not targeting multi-user

It does support parameterized services though, as supported by frr (via
frr@something).

This allows e.g. docker to continue to be enabled after an update to a
newer version. It should now also keep the choice of baseboxd vs ryu on
upgrade (untested though).

If for whatever reason the old system's system-backup.txt or
user-backup.txt are missing, don't fail the installation.

Signed-off-by: Jonas Gorski <[email protected]>
Add support for backing up and restoring explicitly disabled and enabled
services by checking their symlinks and restoring or removing them when
applying the backup.

It does naive enabled/disabled services heuristic:

- if the .preset does not say enabled, and there is a symlink in
  multi-user.target.wants, recreate the symink on restore
- if the .preset says enabled, and there was no symlink in
  multi-user.target.wants, remove the symlink on restore

Additionally, it only checks certain services:
- Skip any oneshot services (these are expected to be disabled with
  enabled preset after first boot)
- Skip any services not targeting multi-user

It does support parameterized services though, as supported by frr (via
frr@something).

This allows e.g. docker to continue to be enabled after an update to a
newer version. It should now also keep the choice of baseboxd vs ryu on
upgrade (untested though).

Signed-off-by: Jonas Gorski <[email protected]>
@KanjiMonster KanjiMonster force-pushed the jogo_installer_systemd_services branch from 8bc762f to 12b82da Compare January 29, 2025 09:21
@KanjiMonster KanjiMonster marked this pull request as draft January 29, 2025 09:28
@KanjiMonster KanjiMonster marked this pull request as ready for review February 5, 2025 16:10
@jklare jklare merged commit d99b28f into main Feb 6, 2025
1 check passed
@jklare jklare deleted the jogo_installer_systemd_services branch February 6, 2025 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants