Setup grub-btrfs correctly for timeshift (#3728)

This commit is contained in:
Daniel Girtler 2025-08-27 18:21:47 +10:00 committed by GitHub
parent f0f882f68b
commit a4324ec5f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 22 additions and 0 deletions

View File

@ -957,6 +957,7 @@ class Installer:
if bootloader and bootloader == Bootloader.Grub:
self.pacman.strap('grub-btrfs')
self.pacman.strap('inotify-tools')
self._configure_grub_btrfsd()
self.enable_service('grub-btrfsd.service')
def setup_swap(self, kind: str = 'zram') -> None:
@ -997,6 +998,27 @@ class Installer:
return root
return None
def _configure_grub_btrfsd(self) -> None:
# See https://github.com/Antynea/grub-btrfs?tab=readme-ov-file#-using-timeshift-with-systemd
debug('Configuring grub-btrfsd service')
# https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html#id-1.14.3
systemd_dir = self.target / 'etc/systemd/system/grub-btrfsd.service.d'
systemd_dir.mkdir(parents=True, exist_ok=True)
override_conf = systemd_dir / 'override.conf'
config_content = textwrap.dedent(
"""
[Service]
ExecStart=
ExecStart=/usr/bin/grub-btrfsd --syslog --timeshift-auto
"""
)
override_conf.write_text(config_content)
override_conf.chmod(0o644)
def _get_luks_uuid_from_mapper_dev(self, mapper_dev_path: Path) -> str:
lsblk_info = get_lsblk_info(mapper_dev_path, reverse=True, full_dev_path=True)