#!/bin/sh # Identité + réseau : hostname, domaine, IP statique. Sauvegarde avant modif. # Ne coupe jamais la connexion sans stratégie de reconnexion planifiée côté webapp. export LC_ALL=C echo "===SU:CUSTOM_IDENTITY===" cp -a /etc/hosts "/etc/hosts.su.bak.$(date +%s)" 2>/dev/null && echo "FILE_MODIFIED=/etc/hosts" cp -a /etc/network/interfaces "/etc/network/interfaces.su.bak.$(date +%s)" 2>/dev/null && echo "FILE_MODIFIED=/etc/network/interfaces" echo "OLD_ENDPOINT={{dhcpEndpoint}}" if hostnamectl set-hostname "{{newHostname}}" 2>&1; then echo "HOSTNAME_SET={{newHostname}}" else echo "ERR=hostname_failed" fi if ip link show "{{interfaceName}}" >/dev/null 2>&1; then echo "IFACE_OK={{interfaceName}}" # Rendu détaillé de /etc/network/interfaces renvoyé à la tâche 4 ; ici on valide la cible. echo "STATIC_TARGET={{staticAddress}} gw {{gateway}} dns {{dnsNameservers}}" else echo "ERR=interface_not_found" fi echo "NEW_ENDPOINT={{reconnectHost}}" echo "RECONNECT_REQUIRED=1" {{#rebootAfterInstall}}echo "REBOOT_REQUESTED=1"{{/rebootAfterInstall}} echo "===SU:EXIT=0==="