fix(post-install): identity_network cadré Debian/ifupdown (VM) avec précheck
- 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 <noreply@anthropic.com>
This commit is contained in:
@@ -48,8 +48,8 @@ export const PROFILES: Record<string, ProfileManifest> = {
|
||||
},
|
||||
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",
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user