correction d'un bug
paramétrer /etc/network/interfaces dans __DEBIAN_NETWORK_INTERFACES pour les tests
This commit is contained in:
parent
8f99945561
commit
dc1be77e2f
33
ulib/debian
33
ulib/debian
|
@ -68,6 +68,7 @@ function service_enable() {
|
|||
# Gestion des interfaces réseau
|
||||
|
||||
__DEBIAN_NETWORK_DEVEL_SHOW_MODIFS=
|
||||
__DEBIAN_NETWORK_INTERFACES=/etc/network/interfaces
|
||||
|
||||
function __network_parse_confbr() {
|
||||
local br; local -a ifaces
|
||||
|
@ -368,7 +369,7 @@ function network_interfaces_check_confbr() {
|
|||
|
||||
local br="$1"
|
||||
local -a ifaces; array_copy ifaces __nicc_ifaces
|
||||
local nifile="${3:-/etc/network/interfaces}"
|
||||
local nifile="${3:-$__DEBIAN_NETWORK_INTERFACES}"
|
||||
|
||||
awkrun <"$nifile" -f br="$br" ifaces[@]=__nicc_ifaces '
|
||||
BEGIN {
|
||||
|
@ -442,7 +443,7 @@ function network_interfaces_check_confip() {
|
|||
|
||||
local iface="$1" gateway="$2"
|
||||
local -a ipsuffixes; array_copy ipsuffixes __nicc_ipsuffixes
|
||||
local nifile="${4:-/etc/network/interfaces}"
|
||||
local nifile="${4:-$__DEBIAN_NETWORK_INTERFACES}"
|
||||
|
||||
awkrun <"$nifile" -f iface="$iface" gateway="$gateway" ipsuffixes[@]=ipsuffixes '
|
||||
BEGIN {
|
||||
|
@ -625,7 +626,7 @@ END {
|
|||
function network_interfaces_remove_iface() {
|
||||
# Supprimer dans le fichier $2(=/etc/network/interfaces) toute la
|
||||
# configuration qui concerne l'interface $1
|
||||
local iface="$1" nifile="${2:-/etc/network/interfaces}"
|
||||
local iface="$1" nifile="${2:-$__DEBIAN_NETWORK_INTERFACES}"
|
||||
local tmpfile; ac_set_tmpfile tmpfile
|
||||
local modified
|
||||
|
||||
|
@ -642,7 +643,7 @@ function network_interfaces_remove_ifaces() {
|
|||
local -a __niri_ifaces; array_copy __niri_ifaces "${1:-ifaces}"
|
||||
|
||||
local -a ifaces; array_copy ifaces __niri_ifaces
|
||||
local nifile="${2:-/etc/network/interfaces}"
|
||||
local nifile="${2:-$__DEBIAN_NETWORK_INTERFACES}"
|
||||
local workfile; ac_set_tmpfile workfile
|
||||
local tmpfile; ac_set_tmpfile tmpfile
|
||||
local iface modified
|
||||
|
@ -678,7 +679,7 @@ function network_interfaces_add_confip() {
|
|||
|
||||
local iface="$1" gateway="$2"
|
||||
local -a ipsuffixes; array_copy ipsuffixes __niac_ipsuffixes
|
||||
local nifile="${4:-/etc/network/interfaces}"
|
||||
local nifile="${4:-$__DEBIAN_NETWORK_INTERFACES}"
|
||||
local mainip netmask method
|
||||
|
||||
network_parse_ipsuffix "${ipsuffixes[0]}" mainip netmask
|
||||
|
@ -718,7 +719,7 @@ function network_interfaces_add_confbr() {
|
|||
local br="$1"
|
||||
local -a ifaces; array_copy ifaces __niac_ifaces
|
||||
local -a confips; array_copy confips __niac_confips
|
||||
local nifile="${4:-/etc/network/interfaces}"
|
||||
local nifile="${4:-$__DEBIAN_NETWORK_INTERFACES}"
|
||||
local iface confip
|
||||
|
||||
for iface in "${ifaces[@]}"; do
|
||||
|
@ -1011,7 +1012,7 @@ function network_config() {
|
|||
if [ -n "$modify" ]; then
|
||||
# faire une copie de travail
|
||||
local interfaces; ac_set_tmpfile interfaces
|
||||
cat /etc/network/interfaces >"$interfaces"
|
||||
cat "$__DEBIAN_NETWORK_INTERFACES" >"$interfaces"
|
||||
|
||||
if [ -n "$reset_interfaces" ]; then
|
||||
echo >"$interfaces" "\
|
||||
|
@ -1031,7 +1032,7 @@ iface lo inet loopback
|
|||
done
|
||||
for confip in "${confips[@]}"; do
|
||||
network_parse_confip "$confip" iface gateway ipsuffixes
|
||||
network_interfaces_remove_iface "$iface"
|
||||
network_interfaces_remove_iface "$iface" "$interfaces"
|
||||
done
|
||||
|
||||
# puis recréer la configuration
|
||||
|
@ -1048,21 +1049,21 @@ iface lo inet loopback
|
|||
|
||||
# Fin de traitement
|
||||
if [ -n "$__DEBIAN_NETWORK_DEVEL_SHOW_MODIFS" ]; then
|
||||
if testdiff "$interfaces" /etc/network/interfaces; then
|
||||
uecho "Setting /etc/network/interfaces to:"
|
||||
if testdiff "$interfaces" "$__DEBIAN_NETWORK_INTERFACES"; then
|
||||
uecho "Setting $__DEBIAN_NETWORK_INTERFACES to:"
|
||||
cat "$interfaces" | sed 's/^/ /g' 1>&2
|
||||
else
|
||||
uecho "/etc/network/interfaces: pas de modifications"
|
||||
uecho "$__DEBIAN_NETWORK_INTERFACES: pas de modifications"
|
||||
fi
|
||||
elif testdiff "$interfaces" /etc/network/interfaces; then
|
||||
__network_backup /etc/network/interfaces
|
||||
elif testdiff "$interfaces" "$__DEBIAN_NETWORK_INTERFACES"; then
|
||||
__network_backup "$__DEBIAN_NETWORK_INTERFACES"
|
||||
if show_debug; then
|
||||
edebug "Setting /etc/network/interfaces to:"
|
||||
edebug "Setting $__DEBIAN_NETWORK_INTERFACES to:"
|
||||
cat "$interfaces" | sed 's/^/ /g' 1>&2
|
||||
else
|
||||
estep /etc/network/interfaces
|
||||
estep "$__DEBIAN_NETWORK_INTERFACES"
|
||||
fi
|
||||
cat "$interfaces" >/etc/network/interfaces
|
||||
cat "$interfaces" >"$__DEBIAN_NETWORK_INTERFACES"
|
||||
modified=1
|
||||
fi
|
||||
ac_clean "$interfaces"
|
||||
|
|
Loading…
Reference in New Issue