instalar DESDE el live: hammer-install in-live + payload de disco (refinamiento #1)
Cierra el lazo ISO live -> disco instalado -> bootea solo. iso-image.sh INSTALLER=1 bundlea kernel + GRUB MBR (boot/core.img + modulos) en el initramfs bajo /usr/lib/hammer/install/ + inyecta /usr/bin/hammer-install. hammer-install corre dentro del live como root real (busybox fdisk/mke2fs/mount/dd + uutils cp): particiona MBR (/,/store,/var/lib/hammer), formatea, copia la propia raiz del live (autoinstalador), escribe /boot+wrapper, instala GRUB con 2 dd (boot->MBR, core->hueco post-MBR; punteros default 1/2 ya valen en MBR contiguo, sin parcheo). AUTO_INSTALL=<dev> = /init desatendido (install+poweroff). iso-install-test.sh valida E2E: ISO+disco blanco -> HAMMER-INSTALL-OK -> boot del disco solo -> GRUB->kernel->arje-zero->sshd, particiones dedicadas montadas. GOTCHAS: busybox fdisk CHS-alinea a 63 (hueco 62 < core 281 sectores) -> pisa el FS de p1 -> grub>; fix sectores explicitos (p1@2048). Copiar top-level de / enumerado, no lista fija, o se escapa /ente/seed.card.json. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+35
-9
@@ -60,17 +60,43 @@ mkdir -p "$ISO_ROOT/boot/grub/i386-pc" "$RFS"
|
||||
echo "==> staging initramfs desde $ROOTFS (hardlinks) + /init marcador"
|
||||
cp -al "$ROOTFS" "$RFS/root"
|
||||
# El cpio se arma desde $RFS/root; inyectamos /init ahí (rdinit=/init lo busca en la raíz del initramfs).
|
||||
cat > "$RFS/root/init" <<'INIT'
|
||||
#!/bin/sh
|
||||
# /init del medio live (Etapa E5): monta lo básico, deja un marcador inequívoco y arranca el init real.
|
||||
/bin/busybox mount -t proc proc /proc 2>/dev/null || true
|
||||
/bin/busybox mount -t sysfs sys /sys 2>/dev/null || true
|
||||
/bin/busybox mount -t devtmpfs dev /dev 2>/dev/null || true
|
||||
echo "HAMMER-ISO-LIVE-OK: medio live arrancado desde El Torito"
|
||||
exec /sbin/init
|
||||
INIT
|
||||
# /init del medio live: monta lo básico + marcador. Con AUTO_INSTALL=<dev>, instala desatendido a ese
|
||||
# disco y apaga (instalación unattended + scaffolding del test); si no, arranca el init real (live).
|
||||
{
|
||||
echo '#!/bin/sh'
|
||||
echo '# /init del medio live (Etapa E5).'
|
||||
echo '/bin/busybox mount -t proc proc /proc 2>/dev/null || true'
|
||||
echo '/bin/busybox mount -t sysfs sys /sys 2>/dev/null || true'
|
||||
echo '/bin/busybox mount -t devtmpfs dev /dev 2>/dev/null || true'
|
||||
echo 'echo "HAMMER-ISO-LIVE-OK: medio live arrancado desde El Torito"'
|
||||
if [ -n "${AUTO_INSTALL:-}" ]; then
|
||||
echo "echo 'HAMMER-AUTO-INSTALL: instalando a ${AUTO_INSTALL}'"
|
||||
echo "if /usr/bin/hammer-install '${AUTO_INSTALL}'; then echo 'HAMMER-INSTALL-OK'; else echo 'HAMMER-INSTALL-FAIL'; fi"
|
||||
echo '/bin/busybox sync'
|
||||
echo '/bin/busybox poweroff -f'
|
||||
else
|
||||
echo 'exec /sbin/init'
|
||||
fi
|
||||
} > "$RFS/root/init"
|
||||
chmod +x "$RFS/root/init"
|
||||
|
||||
# --- INSTALLER=1: payload de instalación a disco DESDE el live (refinamiento #1) ---
|
||||
# Bundle kernel + GRUB (boot.img + core.img MBR-prefix + módulos) bajo /usr/lib/hammer/install/ y el
|
||||
# instalador en /usr/bin/hammer-install. El core.img se arma acá (build-time, el host tiene
|
||||
# grub-mkimage); el live NO lo necesita — sólo dd's. core prefix (hd0,msdos1)/boot/grub para boot MBR.
|
||||
if [ "${INSTALLER:-0}" = 1 ]; then
|
||||
echo "==> INSTALLER=1: bundling payload de instalación a disco (kernel + GRUB MBR + hammer-install)"
|
||||
IPL="$RFS/root/usr/lib/hammer/install"
|
||||
mkdir -p "$IPL/grub/i386-pc" "$IPL/kernel"
|
||||
cp "$KERNEL" "$IPL/kernel/bzImage"; chmod 0644 "$IPL/kernel/bzImage"
|
||||
cp "$GRUB_LIB/boot.img" "$IPL/grub/boot.img"
|
||||
cp "$GRUB_LIB"/*.mod "$GRUB_LIB"/*.lst "$IPL/grub/i386-pc/" 2>/dev/null || true
|
||||
# core.img para disco MBR: prefix a la 1ª partición msdos, módulos de disco (biosdisk/part_msdos/ext2).
|
||||
grub-mkimage -O i386-pc -p '(hd0,msdos1)/boot/grub' -o "$IPL/grub/core.img" \
|
||||
biosdisk part_msdos ext2 normal configfile linux echo ls boot search
|
||||
install -m 0755 "$ROOT/scripts/hammer-live-install.sh" "$RFS/root/usr/bin/hammer-install"
|
||||
fi
|
||||
|
||||
echo "==> empaquetando initramfs.cpio.gz"
|
||||
( cd "$RFS/root" && find . -print0 | cpio --null -o -H newc -R 0:0 2>/dev/null | gzip -1 ) > "$ISO_ROOT/boot/initramfs.cpio.gz"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user