diff --git a/shared/gen-disk-config.py b/shared/gen-disk-config.py index c551127..27f86f0 100644 --- a/shared/gen-disk-config.py +++ b/shared/gen-disk-config.py @@ -9,6 +9,7 @@ # # Layout (replica el hardware): NVMe = ESP 512M + /boot 1G ext4 + / btrfs (resto); # SDA = /home ext4 (todo). swap = zram (lo pone "swap": true del base). +# Si SDA no existe (portatil de 1 disco), se omite: /home queda dentro del / btrfs. import json, sys from pathlib import Path from archinstall.lib.disk.device_handler import device_handler @@ -61,13 +62,19 @@ def main(): sda = sys.argv[3] if len(sys.argv) > 3 else "/dev/sda" dev_nvme = device_handler.get_device(Path(nvme)) + if not dev_nvme: + sys.exit(f"No encuentro el disco de sistema {nvme} (revisa lsblk)") + + # 2 discos -> layout hardware: NVMe=sistema, SDA=/home aparte. + # 1 disco (portatil) -> todo en el NVMe; /home vive dentro del btrfs raiz. dev_sda = device_handler.get_device(Path(sda)) - if not dev_nvme or not dev_sda: - sys.exit(f"No encuentro los discos {nvme} / {sda} (revisa lsblk)") + mods = [nvme_mods(dev_nvme)] + if dev_sda: + mods.append(sda_mods(dev_sda)) layout = DiskLayoutConfiguration( config_type=DiskLayoutType.Manual, - device_modifications=[nvme_mods(dev_nvme), sda_mods(dev_sda)], + device_modifications=mods, ) cfg = json.loads(Path(base_path).read_text()) cfg["disk_config"] = layout.json()