From 3ea2e66359c91156386bb10971dac4c8f8c36422 Mon Sep 17 00:00:00 2001 From: Gilles Soulier Date: Sat, 6 Jun 2026 19:03:28 +0200 Subject: [PATCH] =?UTF-8?q?fix(post-install):=20identity=5Fnetwork=20cadr?= =?UTF-8?q?=C3=A9=20Debian/ifupdown=20(VM)=20avec=20pr=C3=A9check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - précheck en tête : refuse proprement si OS != debian (os_not_supported), si netplan présent (unsupported_network_manager) ou si /etc/network/interfaces absent (ifupdown_not_found) — au lieu d'écrire une conf inopérante - manifeste : label « (Debian/VM) » + description précisant la cible ifupdown et l'application au reboot Validé en réel sur Debian VM (ens18) : strophe DHCP commentée + drop-in statique. sh -n OK · tsc 0 · 113 tests. Co-Authored-By: Claude Opus 4.8 --- server/services/postInstall.ts | 4 ++-- templates/custom/identity-network.sh.tpl | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/server/services/postInstall.ts b/server/services/postInstall.ts index 4f430b2..5f0a0ae 100644 --- a/server/services/postInstall.ts +++ b/server/services/postInstall.ts @@ -48,8 +48,8 @@ export const PROFILES: Record = { }, identity_network: { id: "identity_network", - label: "Hostname + IP statique", - description: "Définit le hostname, le domaine et l'adresse IP statique (sauvegarde des fichiers).", + label: "Hostname + IP statique (Debian/VM)", + description: "Définit hostname, domaine et IP statique. Cible Debian + ifupdown (VM netinstall) ; refuse proprement les autres cas (Ubuntu/netplan…). Réseau appliqué au reboot.", risk: "network_change", requiresConfirmation: true, template: "custom/identity-network.sh.tpl", diff --git a/templates/custom/identity-network.sh.tpl b/templates/custom/identity-network.sh.tpl index 2340467..6b5192e 100644 --- a/templates/custom/identity-network.sh.tpl +++ b/templates/custom/identity-network.sh.tpl @@ -11,6 +11,27 @@ GW="{{gateway}}" DNS="{{dnsNameservers}}" echo "===SU:CUSTOM_IDENTITY===" +# --- Précheck : Debian + ifupdown uniquement (MVP, cible VM netinstall) --- +. /etc/os-release 2>/dev/null +if [ "$ID" != "debian" ]; then + echo "ERR=os_not_supported" + echo "DETAIL=identity_network ne gère que Debian (ID=$ID)" + echo "===SU:EXIT=2===" + exit 2 +fi +if ls /etc/netplan/*.yaml >/dev/null 2>&1; then + echo "ERR=unsupported_network_manager" + echo "DETAIL=netplan détecté ; ce profil cible ifupdown" + echo "===SU:EXIT=2===" + exit 2 +fi +if [ ! -f /etc/network/interfaces ]; then + echo "ERR=ifupdown_not_found" + echo "DETAIL=/etc/network/interfaces absent" + echo "===SU:EXIT=2===" + exit 2 +fi + # --- Sauvegardes --- TS=$(date +%s) cp -a /etc/hosts "/etc/hosts.su.bak.${TS}" 2>/dev/null