Drop disko: use direct sgdisk+mkfs+mount in installer, remove disko package and disko.nix
Agent-Logs-Url: https://github.com/naturallaw777/staging_alpha/sessions/3dbc739b-c3da-432d-b070-16217e58c76b Co-authored-by: naturallaw777 <99053422+naturallaw777@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
53a0010e47
commit
cb7b097ce0
@@ -710,7 +710,7 @@ class InstallerWindow(Adw.ApplicationWindow):
|
||||
boot_path = f"/dev/{self.boot_disk}"
|
||||
data_path = f"/dev/{self.data_disk}" if self.data_disk else None
|
||||
|
||||
# ── Wipe disk(s) to clear stale GPT/MBR data before disko ──
|
||||
# ── Wipe disk(s) ──
|
||||
GLib.idle_add(append_text, buf, "=== Wiping disk(s) ===\n")
|
||||
|
||||
run_stream(["sudo", "sgdisk", "--zap-all", boot_path], buf)
|
||||
@@ -720,26 +720,54 @@ class InstallerWindow(Adw.ApplicationWindow):
|
||||
run_stream(["sudo", "sgdisk", "--zap-all", data_path], buf)
|
||||
run_stream(["sudo", "wipefs", "--all", "--force", data_path], buf)
|
||||
|
||||
# Inform the kernel of the wiped partition tables
|
||||
run_stream(["sudo", "partprobe", boot_path], buf)
|
||||
if data_path:
|
||||
run_stream(["sudo", "partprobe", data_path], buf)
|
||||
|
||||
# Short settle so the kernel finishes re-reading
|
||||
time.sleep(2)
|
||||
|
||||
# ── Now run disko to partition, format, and mount ──
|
||||
# Disks are already wiped clean by sgdisk/wipefs above,
|
||||
# so we only need disko to create partitions, format, and mount.
|
||||
GLib.idle_add(append_text, buf, "\n=== Partitioning and formatting drives ===\n")
|
||||
cmd = [
|
||||
"sudo", "disko", "--mode", "format,mount",
|
||||
f"{FLAKE}/iso/disko.nix",
|
||||
"--arg", "device", boot_path
|
||||
]
|
||||
# ── Partition boot disk: 512M ESP + rest as root ──
|
||||
GLib.idle_add(append_text, buf, "\n=== Partitioning boot disk ===\n")
|
||||
run_stream(["sudo", "sgdisk",
|
||||
"-n", "1:1M:+512M", "-t", "1:EF00", "-c", "1:ESP",
|
||||
"-n", "2:0:0", "-t", "2:8300", "-c", "2:root",
|
||||
boot_path], buf)
|
||||
|
||||
run_stream(["sudo", "partprobe", boot_path], buf)
|
||||
time.sleep(2)
|
||||
|
||||
# ── Partition data disk (if selected) ──
|
||||
if data_path:
|
||||
cmd += ["--arg", "dataDevice", data_path]
|
||||
run_stream(cmd, buf)
|
||||
GLib.idle_add(append_text, buf, "\n=== Partitioning data disk ===\n")
|
||||
run_stream(["sudo", "sgdisk",
|
||||
"-n", "1:1M:0", "-t", "1:8300", "-c", "1:primary",
|
||||
data_path], buf)
|
||||
|
||||
run_stream(["sudo", "partprobe", data_path], buf)
|
||||
time.sleep(2)
|
||||
|
||||
# ── Format partitions ──
|
||||
GLib.idle_add(append_text, buf, "\n=== Formatting partitions ===\n")
|
||||
boot_p1 = f"{boot_path}p1" if "nvme" in boot_path else f"{boot_path}1"
|
||||
boot_p2 = f"{boot_path}p2" if "nvme" in boot_path else f"{boot_path}2"
|
||||
|
||||
run_stream(["sudo", "mkfs.vfat", "-F", "32", boot_p1], buf)
|
||||
run_stream(["sudo", "mkfs.ext4", "-F", "-L", "sovran_systemsos", boot_p2], buf)
|
||||
|
||||
if data_path:
|
||||
data_p1 = f"{data_path}p1" if "nvme" in data_path else f"{data_path}1"
|
||||
run_stream(["sudo", "mkfs.ext4", "-F", "-L", "BTCEcoandBackup", data_p1], buf)
|
||||
|
||||
# ── Mount filesystems ──
|
||||
GLib.idle_add(append_text, buf, "\n=== Mounting filesystems ===\n")
|
||||
run_stream(["sudo", "mount", boot_p2, "/mnt"], buf)
|
||||
run_stream(["sudo", "mkdir", "-p", "/mnt/boot/efi"], buf)
|
||||
run_stream(["sudo", "mount", "-o", "umask=0077,defaults", boot_p1, "/mnt/boot/efi"], buf)
|
||||
|
||||
if data_path:
|
||||
data_p1 = f"{data_path}p1" if "nvme" in data_path else f"{data_path}1"
|
||||
run_stream(["sudo", "mkdir", "-p", "/mnt/run/media/Second_Drive"], buf)
|
||||
run_stream(["sudo", "mount", data_p1, "/mnt/run/media/Second_Drive"], buf)
|
||||
|
||||
GLib.idle_add(append_text, buf, "\n=== Generating hardware config ===\n")
|
||||
run_stream(["sudo", "nixos-generate-config", "--root", "/mnt"], buf)
|
||||
|
||||
Reference in New Issue
Block a user