suite implémentation nouvelles fonctions
This commit is contained in:
parent
071032b20a
commit
e6154a4dfd
55
ulib/debian
55
ulib/debian
|
@ -269,10 +269,52 @@ function network_fix_confips() {
|
||||||
array_copy "${1:-confips}" __nfc_confips
|
array_copy "${1:-confips}" __nfc_confips
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function __network_fix_mainiface() {
|
||||||
|
local -a confips ifaces ipsuffixes
|
||||||
|
local br iface gateway confip mainconfip
|
||||||
|
|
||||||
|
# déterminer mainiface
|
||||||
|
if [ -z "$mainiface" -a -n "${__nfm_confbrs[0]}" ]; then
|
||||||
|
network_parse_confbr "${__nfm_confbrs[0]}" br ifaces
|
||||||
|
mainiface="$br"
|
||||||
|
fi
|
||||||
|
if [ -z "$mainiface" -a -n "${__nfm_confips[0]}" ]; then
|
||||||
|
network_parse_confip "${__nfm_confips[0]}" iface gateway ipsuffixes
|
||||||
|
mainiface="$iface"
|
||||||
|
fi
|
||||||
|
[ -n "$mainiface" ] || mainiface=eth0
|
||||||
|
|
||||||
|
# ensuite, il faut reécrire confips avec la valeur de mainiface
|
||||||
|
array_new confips
|
||||||
|
for confip in "${__nfm_confips[@]}"; do
|
||||||
|
network_parse_confip "$confip" iface gateway ipsuffixes
|
||||||
|
[ -n "$iface" ] || iface="$mainiface"
|
||||||
|
confip="$(network_format_confip "$iface" "$gateway" ipsuffixes)"
|
||||||
|
if [ "$iface" == "$mainiface" ]; then
|
||||||
|
mainconfip="$confip"
|
||||||
|
else
|
||||||
|
array_add confips "$confip"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
[ -n "$mainconfip" ] && array_ins confips "$mainconfip"
|
||||||
|
|
||||||
|
array_copy __nfm_confips confips
|
||||||
|
}
|
||||||
function network_fix_mainiface() {
|
function network_fix_mainiface() {
|
||||||
# réorganiser les tableaux de façon que confips[0] devienne la configuration
|
# A partir des valeurs des tableaux $1(=confbrs) et $2(=confips), et de
|
||||||
# ip de l'interface principale
|
# l'interface principale $3, déterminer l'interface principale. Si $3 est
|
||||||
:
|
# spécifié, c'est la valeur sélectionnée. Sinon, si un bridge existe, c'est
|
||||||
|
# le premier bridge qui est sélectionné. Sinon, la première interface est
|
||||||
|
# sélectionnée. Sinon, on prend eth0.
|
||||||
|
# Ensuite, réorganiser les tableaux de façon que confips[0] devienne la
|
||||||
|
# configuration ip de l'interface principale.
|
||||||
|
local -a __nfm_confbrs __nfm_confips
|
||||||
|
array_copy __nfm_confbrs "${1:-confbrs}"
|
||||||
|
array_copy __nfm_confips "${2:-confips}"
|
||||||
|
local mainiface="$3"
|
||||||
|
__network_fix_mainiface
|
||||||
|
|
||||||
|
array_copy "${2:-confips}" __nfm_confips
|
||||||
}
|
}
|
||||||
|
|
||||||
function network_fix_confs() {
|
function network_fix_confs() {
|
||||||
|
@ -518,13 +560,6 @@ $ip$TAB$host $hostname" "$tmpfile"
|
||||||
ac_clean "$tmpfile"
|
ac_clean "$tmpfile"
|
||||||
}
|
}
|
||||||
|
|
||||||
function __old_network_resolve_mainiface() {
|
|
||||||
local __nrm_mainiface="${1:-mainiface}" __nrm_mainconfbr="$2" __nrm_mainconfip="$3"
|
|
||||||
[ -n "${!__nrm_mainiface}" ] || __old_network_parse_confbr "$__nrm_mainconfbr" "$__nrm_mainiface"
|
|
||||||
[ -n "${!__nrm_mainiface}" ] || __old_network_parse_confip "$__nrm_mainconfip" "$__nrm_mainiface"
|
|
||||||
[ -n "${!__nrm_mainiface}" ] || set_var "$__nrm_mainiface" eth0
|
|
||||||
}
|
|
||||||
|
|
||||||
__DEBIAN_NETWORK_UPDATE_BASE_SCRIPT='
|
__DEBIAN_NETWORK_UPDATE_BASE_SCRIPT='
|
||||||
BEGIN {
|
BEGIN {
|
||||||
method = "dhcp"
|
method = "dhcp"
|
||||||
|
|
Loading…
Reference in New Issue