Delegate Snapper setup to Omarchy packages
This commit is contained in:
1 parent
58221e5ed6
commit
8c77631f68
4 files changed
+6
-70
No files matched your search
@@ -1314,11 +1314,6 @@ cat <<-_EOF_ >user_configuration.json
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"disk_config": {
|
"disk_config": {
|
||||||
"btrfs_options": {
|
|
||||||
"snapshot_config": {
|
|
||||||
"type": "Snapper"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"config_type": "default_layout",
|
"config_type": "default_layout",
|
||||||
"device_modifications": [
|
"device_modifications": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ Phase ordering (full-disk and protected/pre-mounted):
|
|||||||
pre_mounted_config; no-op for full-disk installs
|
pre_mounted_config; no-op for full-disk installs
|
||||||
arch_install_system → one archinstall flow for partition/mount-or-use,
|
arch_install_system → one archinstall flow for partition/mount-or-use,
|
||||||
base install, early Omarchy packages, Limine setup,
|
base install, early Omarchy packages, Limine setup,
|
||||||
useradd, runtime Omarchy packages, Snapper, fstab
|
useradd, runtime Omarchy packages, fstab
|
||||||
configure_hibernation → root-owned swap/resume drop-ins
|
configure_hibernation → root-owned swap/resume drop-ins
|
||||||
run_system_finalizer → arch-chroot root omarchy-setup-system
|
run_system_finalizer → arch-chroot root omarchy-setup-system, including Snapper
|
||||||
finalize_limine_boot → final Limine config/UKI build after hardware drop-ins
|
finalize_limine_boot → final Limine config/UKI build after hardware drop-ins
|
||||||
run_chroot_finalizer → arch-chroot -u user omarchy-finalize-user
|
run_chroot_finalizer → arch-chroot -u user omarchy-finalize-user
|
||||||
configure_login → sddm state + encrypted-install autologin
|
configure_login → sddm state + encrypted-install autologin
|
||||||
@@ -275,9 +275,6 @@ def arch_install_system(ctx: InstallContext) -> None:
|
|||||||
finally:
|
finally:
|
||||||
_unmask_mkinitcpio_pacman_hooks(ctx)
|
_unmask_mkinitcpio_pacman_hooks(ctx)
|
||||||
|
|
||||||
info("› configuring root Snapper snapshots")
|
|
||||||
_configure_snapper_root(ctx)
|
|
||||||
|
|
||||||
# Standard arch finishers.
|
# Standard arch finishers.
|
||||||
if config.timezone:
|
if config.timezone:
|
||||||
installer.set_timezone(config.timezone)
|
installer.set_timezone(config.timezone)
|
||||||
@@ -540,57 +537,6 @@ def _installer_esp_mount(installer) -> str:
|
|||||||
return "/boot"
|
return "/boot"
|
||||||
|
|
||||||
|
|
||||||
def _configure_snapper_root(ctx: InstallContext) -> None:
|
|
||||||
"""Configure Omarchy's root-only Snapper setup during the archinstall
|
|
||||||
phase, not inside the finalizer chroot.
|
|
||||||
|
|
||||||
archinstall's own setup_btrfs_snapshot() uses `snapper --no-dbus` because
|
|
||||||
snapperd/DBus are not available in arch-chroot. We mirror that proven
|
|
||||||
chroot-safe call, but only create the root config: Omarchy intentionally
|
|
||||||
does not snapshot /home user data.
|
|
||||||
"""
|
|
||||||
config_path = ctx.target / "etc" / "snapper" / "configs" / "root"
|
|
||||||
if not config_path.exists():
|
|
||||||
subprocess.run(
|
|
||||||
[
|
|
||||||
"arch-chroot",
|
|
||||||
"-S",
|
|
||||||
str(ctx.target),
|
|
||||||
"snapper",
|
|
||||||
"--no-dbus",
|
|
||||||
"-c",
|
|
||||||
"root",
|
|
||||||
"create-config",
|
|
||||||
"/",
|
|
||||||
],
|
|
||||||
check=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
template_candidates = [
|
|
||||||
ctx.target / "etc" / "snapper" / "config-templates" / "omarchy",
|
|
||||||
ctx.target / "usr" / "share" / "omarchy" / "default" / "snapper" / "root",
|
|
||||||
]
|
|
||||||
template = next((path for path in template_candidates if path.exists()), None)
|
|
||||||
if template is None:
|
|
||||||
searched = "\n ".join(str(path) for path in template_candidates)
|
|
||||||
raise RuntimeError(f"Snapper root template not found. Searched:\n {searched}")
|
|
||||||
|
|
||||||
config_path.parent.mkdir(parents=True, exist_ok=True)
|
|
||||||
shutil.copy2(template, config_path)
|
|
||||||
|
|
||||||
conf_path = ctx.target / "etc" / "conf.d" / "snapper"
|
|
||||||
conf_path.parent.mkdir(parents=True, exist_ok=True)
|
|
||||||
if conf_path.exists():
|
|
||||||
text = conf_path.read_text()
|
|
||||||
if re.search(r"^SNAPPER_CONFIGS=", text, flags=re.MULTILINE):
|
|
||||||
text = re.sub(r'^SNAPPER_CONFIGS=.*$', 'SNAPPER_CONFIGS="root"', text, flags=re.MULTILINE)
|
|
||||||
else:
|
|
||||||
text = text.rstrip() + '\nSNAPPER_CONFIGS="root"\n'
|
|
||||||
conf_path.write_text(text)
|
|
||||||
else:
|
|
||||||
conf_path.write_text('SNAPPER_CONFIGS="root"\n')
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _limine_template(ctx: InstallContext, filename: str) -> Path:
|
def _limine_template(ctx: InstallContext, filename: str) -> Path:
|
||||||
candidates = [
|
candidates = [
|
||||||
@@ -1134,11 +1080,6 @@ def finalize_limine_boot(ctx: InstallContext) -> None:
|
|||||||
check=False,
|
check=False,
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
)
|
)
|
||||||
subprocess.run(
|
|
||||||
["arch-chroot", str(ctx.target), "systemctl", "enable", "limine-snapper-sync.service"],
|
|
||||||
check=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
if "Omarchy" not in limine_conf.read_text():
|
if "Omarchy" not in limine_conf.read_text():
|
||||||
raise RuntimeError(f"{limine_conf} has no Omarchy entry")
|
raise RuntimeError(f"{limine_conf} has no Omarchy entry")
|
||||||
if "cryptdevice=" in cmdline and "cryptdevice=" not in limine_conf.read_text():
|
if "cryptdevice=" in cmdline and "cryptdevice=" not in limine_conf.read_text():
|
||||||
|
|||||||
@@ -1429,11 +1429,11 @@
|
|||||||
"uid": 0,
|
"uid": 0,
|
||||||
"user": "root"
|
"user": "root"
|
||||||
},
|
},
|
||||||
"/etc/systemd/system/timers.target.wants/snapper-timeline.timer": {
|
"/etc/systemd/system/timers.target.wants/snapper-cleanup.timer": {
|
||||||
"gid": 0,
|
"gid": 0,
|
||||||
"group": "root",
|
"group": "root",
|
||||||
"mode": "0o777",
|
"mode": "0o777",
|
||||||
"target": "/usr/lib/systemd/system/snapper-timeline.timer",
|
"target": "/usr/lib/systemd/system/snapper-cleanup.timer",
|
||||||
"type": "symlink",
|
"type": "symlink",
|
||||||
"uid": 0,
|
"uid": 0,
|
||||||
"user": "root"
|
"user": "root"
|
||||||
|
|||||||
@@ -1381,11 +1381,11 @@
|
|||||||
"uid": 0,
|
"uid": 0,
|
||||||
"user": "root"
|
"user": "root"
|
||||||
},
|
},
|
||||||
"/etc/systemd/system/timers.target.wants/snapper-timeline.timer": {
|
"/etc/systemd/system/timers.target.wants/snapper-cleanup.timer": {
|
||||||
"gid": 0,
|
"gid": 0,
|
||||||
"group": "root",
|
"group": "root",
|
||||||
"mode": "0o777",
|
"mode": "0o777",
|
||||||
"target": "/usr/lib/systemd/system/snapper-timeline.timer",
|
"target": "/usr/lib/systemd/system/snapper-cleanup.timer",
|
||||||
"type": "symlink",
|
"type": "symlink",
|
||||||
"uid": 0,
|
"uid": 0,
|
||||||
"user": "root"
|
"user": "root"
|
||||||
|
|||||||
Reference in new issue
Block a user