Files
pvedhcp/dhclient-hook
SDEInfoandCopilot 3a823ef2ff Ajouter les fichiers manquants (unités systemd, hooks DHCP) et corriger install-pve-netconfig.sh
- Les fichiers pve-netconfig.service, pve-netconfig-watch.service,
  pve-netconfig.timer, dhclient-hook et dhcpcd-hook n'avaient jamais ete
  ajoutes au depot git : un git clone frais ne les contenait pas, ce qui
  faisait echouer install-pve-netconfig.sh (install: cannot stat ...).
- install-pve-netconfig.sh applique desormais automatiquement la
  configuration DHCP (apply-interfaces + check + demarrage des services)
  au lieu de se limiter a des instructions manuelles, avec une option
  SKIP_AUTO_APPLY=1 pour desactiver ce comportement.
- Bit executable ajoute sur install-pve-netconfig.sh, dhclient-hook et
  dhcpcd-hook.
- README.md mis a jour avec l'URL reelle du depot (https://git.sdeinfo.app/sde/pvedhcp.git)
  et le nouveau comportement automatique.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-09-10 15:55:53 +02:00

25 lines
794 B
Bash
Executable File

#!/bin/bash
#===============================================================================
# Hook de sortie dhclient (isc-dhcp-client).
# Installe dans /etc/dhcp/dhclient-exit-hooks.d/pve-netconfig
#
# Declenche a chaque evenement du client DHCP (BOUND, RENEW, REBIND, EXPIRE...).
# Sur obtention/renouvellement de bail : synchronise /etc/hosts et leve un
# eventuel fallback statique. dhclient exporte $interface et $reason.
#===============================================================================
SCRIPT="/usr/local/sbin/pve-netconfig.sh"
[[ -x "$SCRIPT" ]] || exit 0
case "${reason:-}" in
BOUND|RENEW|REBIND|REBOOT|STATIC)
"$SCRIPT" sync-hosts >/dev/null 2>&1 &
;;
EXPIRE|NOCARRIER|FAIL)
"$SCRIPT" check >/dev/null 2>&1 &
;;
esac
exit 0