disk-config: soportar instalación en un solo disco
Si /dev/sda no existe (portátil de 1 disco), se omite y /home queda dentro del btrfs raíz. Con dos discos, comportamiento de siempre. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
#
|
#
|
||||||
# Layout (replica el hardware): NVMe = ESP 512M + /boot 1G ext4 + / btrfs (resto);
|
# Layout (replica el hardware): NVMe = ESP 512M + /boot 1G ext4 + / btrfs (resto);
|
||||||
# SDA = /home ext4 (todo). swap = zram (lo pone "swap": true del base).
|
# 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
|
import json, sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from archinstall.lib.disk.device_handler import device_handler
|
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"
|
sda = sys.argv[3] if len(sys.argv) > 3 else "/dev/sda"
|
||||||
|
|
||||||
dev_nvme = device_handler.get_device(Path(nvme))
|
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))
|
dev_sda = device_handler.get_device(Path(sda))
|
||||||
if not dev_nvme or not dev_sda:
|
mods = [nvme_mods(dev_nvme)]
|
||||||
sys.exit(f"No encuentro los discos {nvme} / {sda} (revisa lsblk)")
|
if dev_sda:
|
||||||
|
mods.append(sda_mods(dev_sda))
|
||||||
|
|
||||||
layout = DiskLayoutConfiguration(
|
layout = DiskLayoutConfiguration(
|
||||||
config_type=DiskLayoutType.Manual,
|
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 = json.loads(Path(base_path).read_text())
|
||||||
cfg["disk_config"] = layout.json()
|
cfg["disk_config"] = layout.json()
|
||||||
|
|||||||
Reference in New Issue
Block a user