Skip to content

Commit a4324ec

Browse files
authored
Setup grub-btrfs correctly for timeshift (#3728)
1 parent f0f882f commit a4324ec

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

archinstall/lib/installer.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,6 +957,7 @@ def setup_btrfs_snapshot(
957957
if bootloader and bootloader == Bootloader.Grub:
958958
self.pacman.strap('grub-btrfs')
959959
self.pacman.strap('inotify-tools')
960+
self._configure_grub_btrfsd()
960961
self.enable_service('grub-btrfsd.service')
961962

962963
def setup_swap(self, kind: str = 'zram') -> None:
@@ -997,6 +998,27 @@ def _get_root(self) -> PartitionModification | LvmVolume | None:
997998
return root
998999
return None
9991000

1001+
def _configure_grub_btrfsd(self) -> None:
1002+
# See https://github.com/Antynea/grub-btrfs?tab=readme-ov-file#-using-timeshift-with-systemd
1003+
debug('Configuring grub-btrfsd service')
1004+
1005+
# https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html#id-1.14.3
1006+
systemd_dir = self.target / 'etc/systemd/system/grub-btrfsd.service.d'
1007+
systemd_dir.mkdir(parents=True, exist_ok=True)
1008+
1009+
override_conf = systemd_dir / 'override.conf'
1010+
1011+
config_content = textwrap.dedent(
1012+
"""
1013+
[Service]
1014+
ExecStart=
1015+
ExecStart=/usr/bin/grub-btrfsd --syslog --timeshift-auto
1016+
"""
1017+
)
1018+
1019+
override_conf.write_text(config_content)
1020+
override_conf.chmod(0o644)
1021+
10001022
def _get_luks_uuid_from_mapper_dev(self, mapper_dev_path: Path) -> str:
10011023
lsblk_info = get_lsblk_info(mapper_dev_path, reverse=True, full_dev_path=True)
10021024

0 commit comments

Comments
 (0)