Adapta el instalador a archinstall 4.3 y arregla paru/helpwire
- disk_config: archinstall 4.3 cambió el schema (exige sector_size, sin unidad Percent). Nuevo shared/gen-disk-config.py genera el layout con los modelos de archinstall, dimensionado al disco real; ambos setup.sh lo invocan y se quita el disk_config 3.0 muerto de los JSON. - paru: compilar de fuente, no paru-bin (su binario enlaza contra una libalpm.so concreta y rompe si la del sistema nuevo difiere). - rustup default stable antes de compilar paru (si no, no hay cargo). - helpwire: debtap nombra el paquete 'helpwire', no 'helpwire-operator'; convertir en dir limpio e instalar el único .zst. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
8edbd0d026
commit
e15727782d
@@ -0,0 +1,77 @@
|
||||
#!/usr/bin/env python3
|
||||
# Genera el disk_config de archinstall (>=4.x) dimensionado al disco REAL y lo
|
||||
# inyecta en el JSON base. archinstall 4.x quitó la unidad "Percent", así que un
|
||||
# JSON con tamaños fijos no es portable entre la VM (20G/10G) y el hardware
|
||||
# (250G/1TB): por eso se calcula en tiempo de instalación con los propios modelos
|
||||
# de archinstall (válido ante cambios de schema entre versiones).
|
||||
#
|
||||
# gen-disk-config.py BASE.json [NVME_DEV] [SDA_DEV] > merged.json
|
||||
#
|
||||
# Layout (replica el hardware): NVMe = ESP 512M + /boot 1G ext4 + / btrfs (resto);
|
||||
# SDA = /home ext4 (todo). swap = zram (lo pone "swap": true del base).
|
||||
import json, sys
|
||||
from pathlib import Path
|
||||
from archinstall.lib.disk.device_handler import device_handler
|
||||
from archinstall.lib.models.device import (
|
||||
DiskLayoutConfiguration, DiskLayoutType, DeviceModification,
|
||||
PartitionModification, ModificationStatus, PartitionType,
|
||||
FilesystemType, PartitionFlag, Size, Unit,
|
||||
)
|
||||
|
||||
MiB = 1024 ** 2
|
||||
END_MARGIN = MiB # deja 1 MiB al final para la cabecera GPT de respaldo
|
||||
|
||||
def part(status, ptype, start_b, len_b, ss, fs=None, mnt=None, flags=()):
|
||||
return PartitionModification(
|
||||
status=status, type=ptype,
|
||||
start=Size(start_b, Unit.B, ss),
|
||||
length=Size(len_b, Unit.B, ss),
|
||||
fs_type=fs, mountpoint=Path(mnt) if mnt else None,
|
||||
flags=list(flags),
|
||||
)
|
||||
|
||||
def nvme_mods(dev):
|
||||
ss = dev.device_info.sector_size
|
||||
total = dev.device_info.total_size._normalize()
|
||||
esp_start, esp_len = 1 * MiB, 511 * MiB # 1 -> 512 MiB
|
||||
boot_start, boot_len = 512 * MiB, 1024 * MiB # 512 -> 1536 MiB
|
||||
root_start = boot_start + boot_len # 1536 MiB
|
||||
root_len = total - root_start - END_MARGIN
|
||||
return DeviceModification(device=dev, wipe=True, partitions=[
|
||||
part(ModificationStatus.CREATE, PartitionType.PRIMARY, esp_start, esp_len, ss,
|
||||
FilesystemType.FAT32, "/boot/efi", (PartitionFlag.BOOT, PartitionFlag.ESP)),
|
||||
part(ModificationStatus.CREATE, PartitionType.PRIMARY, boot_start, boot_len, ss,
|
||||
FilesystemType.EXT4, "/boot"),
|
||||
part(ModificationStatus.CREATE, PartitionType.PRIMARY, root_start, root_len, ss,
|
||||
FilesystemType.BTRFS, "/"),
|
||||
])
|
||||
|
||||
def sda_mods(dev):
|
||||
ss = dev.device_info.sector_size
|
||||
total = dev.device_info.total_size._normalize()
|
||||
start = 1 * MiB
|
||||
return DeviceModification(device=dev, wipe=True, partitions=[
|
||||
part(ModificationStatus.CREATE, PartitionType.PRIMARY, start,
|
||||
total - start - END_MARGIN, ss, FilesystemType.EXT4, "/home"),
|
||||
])
|
||||
|
||||
def main():
|
||||
base_path = sys.argv[1]
|
||||
nvme = sys.argv[2] if len(sys.argv) > 2 else "/dev/nvme0n1"
|
||||
sda = sys.argv[3] if len(sys.argv) > 3 else "/dev/sda"
|
||||
|
||||
dev_nvme = device_handler.get_device(Path(nvme))
|
||||
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)")
|
||||
|
||||
layout = DiskLayoutConfiguration(
|
||||
config_type=DiskLayoutType.Manual,
|
||||
device_modifications=[nvme_mods(dev_nvme), sda_mods(dev_sda)],
|
||||
)
|
||||
cfg = json.loads(Path(base_path).read_text())
|
||||
cfg["disk_config"] = layout.json()
|
||||
json.dump(cfg, sys.stdout, indent=2)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -41,9 +41,14 @@ as_user() { sudo -u "$INSTALL_USER" bash -lc "$*"; }
|
||||
bootstrap_paru() {
|
||||
command -v paru &>/dev/null && return 0
|
||||
install_pacman git base-devel
|
||||
as_user 'cd /tmp && rm -rf paru-bin && \
|
||||
git clone https://aur.archlinux.org/paru-bin.git && \
|
||||
cd paru-bin && makepkg -si --noconfirm'
|
||||
# rustup sin toolchain por defecto no expone cargo y rompe el build de paru
|
||||
as_user 'rustup default stable'
|
||||
# paru (fuente, no paru-bin): el binario de paru-bin enlaza contra una
|
||||
# libalpm.so concreta y rompe si la del sistema nuevo difiere; compilar de
|
||||
# fuente enlaza contra la libalpm instalada.
|
||||
as_user 'cd /tmp && rm -rf paru && \
|
||||
git clone https://aur.archlinux.org/paru.git && \
|
||||
cd paru && makepkg -si --noconfirm'
|
||||
}
|
||||
|
||||
install_aur() {
|
||||
@@ -57,7 +62,10 @@ install_helpwire() {
|
||||
local url="https://www.helpwire.app/downloads/operator/linux/helpwire-operator.deb"
|
||||
install_aur debtap
|
||||
as_user "sudo debtap -u || true"
|
||||
as_user "cd /tmp && curl -fsSL -o helpwire.deb '$url' && \
|
||||
yes '' | sudo debtap -Q helpwire.deb && \
|
||||
sudo pacman -U --noconfirm helpwire-operator*.pkg.tar.zst"
|
||||
# debtap nombra el paquete por el campo Package del .deb ('helpwire', no
|
||||
# 'helpwire-operator'): convertir en un dir limpio e instalar el único .zst,
|
||||
# sin depender del nombre exacto.
|
||||
as_user "d=\$(mktemp -d) && cd \"\$d\" && curl -fsSL -o hw.deb '$url' && \
|
||||
yes '' | sudo debtap -Q hw.deb && \
|
||||
sudo pacman -U --noconfirm \"\$d\"/*.pkg.tar.zst && rm -rf \"\$d\""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user