V8.00.000.2025.06.17
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m50s
All checks were successful
🛡️ Shell Script Linting / 🛡️ Shell Script Linting (push) Successful in 1m50s
Signed-off-by: Marc S. Weidner <msw@coresecret.dev>
This commit is contained in:
@@ -21,9 +21,8 @@ guard_sourcing
|
||||
# VAR_FINAL_IPV4
|
||||
# VAR_FINAL_IPV4_GW
|
||||
# VAR_FINAL_IPV4_SUBNET
|
||||
# VAR_FINAL_IPV6
|
||||
# VAR_FINAL_IPV6_CIDR
|
||||
# VAR_FINAL_IPV6_GW
|
||||
# VAR_FINAL_IPV6_SUBNET
|
||||
# VAR_FINAL_NIC
|
||||
# VAR_LINK_IPV6
|
||||
# network_autoconfig_enable
|
||||
@@ -38,7 +37,8 @@ guard_sourcing
|
||||
#######################################
|
||||
installation_network() {
|
||||
### Declare Arrays, HashMaps, and Variables.
|
||||
declare var_supersede="" var_supersede_ipv6=""
|
||||
declare var_supersede=""
|
||||
declare -a ary_dns_supersede=()
|
||||
declare -r var_logfile="/root/.ciss/cdi/log/4300_installation_network.log"
|
||||
|
||||
chroot_logger "${TARGET}${var_logfile}"
|
||||
@@ -86,7 +86,7 @@ installation_network() {
|
||||
# This file describes the network interfaces available on your system
|
||||
# and how to activate them. For more information, see interfaces(5).
|
||||
|
||||
source-directory /etc/network/interfaces.d/*
|
||||
source-directory /etc/network/interfaces.d
|
||||
|
||||
# The loopback network interface
|
||||
auto lo
|
||||
@@ -131,7 +131,6 @@ EOF
|
||||
|
||||
if [[ "${network_autoconfig_enable}" == "false" ]]; then
|
||||
|
||||
# shellcheck disable=SC2153
|
||||
insert_header "${TARGET}/etc/network/interfaces.d/10-ipv4-static"
|
||||
insert_comments "${TARGET}/etc/network/interfaces.d/10-ipv4-static"
|
||||
cat << EOF >> "${TARGET}/etc/network/interfaces.d/10-ipv4-static"
|
||||
@@ -173,7 +172,7 @@ EOF
|
||||
cat << EOF >> "${TARGET}/etc/network/interfaces.d/10-ipv6-static"
|
||||
# The primary network interface: IPv6 via static IP
|
||||
iface ${VAR_FINAL_NIC} inet6 static
|
||||
address ${VAR_FINAL_IPV6}/${VAR_FINAL_IPV6_SUBNET}
|
||||
address ${VAR_FINAL_IPV6_CIDR}
|
||||
gateway ${VAR_FINAL_IPV6_GW}
|
||||
dns-nameservers ${ARY_IPV6_NS[*]}
|
||||
|
||||
@@ -185,7 +184,7 @@ EOF
|
||||
fi
|
||||
|
||||
|
||||
### Ensure 'dhcpcd-base' DHCP Client is not overwriting the static nameserver settings.
|
||||
### Prepare basic 'dhcpcd-base' DHCP Client options.
|
||||
if [[ -f "${TARGET}/etc/dhcpcd.conf" ]]; then
|
||||
|
||||
mkdir -p "${TARGET}/root/.ciss/cdi/backup/etc"
|
||||
@@ -218,35 +217,26 @@ fqdn both
|
||||
EOF
|
||||
|
||||
|
||||
if [[ -n "${network_static_ipv4nameserver_0}" ]]; then
|
||||
### Ensure 'dhcpcd-base' DHCP Client is not overwriting the static nameserver settings.
|
||||
### Collect static DNS from YAML (IPv4 and IPv6).
|
||||
[[ -n "${network_static_ipv4nameserver_0:-}" ]] && ary_dns_supersede+=( "${ARY_IPV4_NS[@]}" )
|
||||
[[ -n "${network_static_ipv6nameserver_0:-}" ]] && ary_dns_supersede+=( "${ARY_IPV6_NS[@]}" )
|
||||
|
||||
if [[ "${#ary_dns_supersede[@]}" -gt 0 ]]; then
|
||||
|
||||
cat << EOF >> "${TARGET}/etc/dhcpcd.conf"
|
||||
### Enforce static DNS
|
||||
nooption domain_name_servers
|
||||
nohook rdnssd
|
||||
|
||||
### Static resolvers (IPv4).
|
||||
### Static DNS-resolvers
|
||||
interface ${VAR_FINAL_NIC}
|
||||
EOF
|
||||
|
||||
var_supersede=$(printf "%s " "${ARY_IPV4_NS[@]}")
|
||||
var_supersede=$(printf "%s " "${ary_dns_supersede[@]}")
|
||||
echo " static domain_name_servers=${var_supersede}" >> "${TARGET}/etc/dhcpcd.conf"
|
||||
|
||||
do_log "info" "file_only" "4300() DHCP client configuration for IPv4: '${TARGET}/etc/dhcpcd.conf' configured."
|
||||
|
||||
fi
|
||||
|
||||
|
||||
if [[ -n "${network_static_ipv6nameserver_0}" ]]; then
|
||||
|
||||
cat << EOF >> "${TARGET}/etc/dhcpcd.conf"
|
||||
|
||||
### Static resolvers (IPv6).
|
||||
EOF
|
||||
var_supersede_ipv6=$(printf "%s " "${ARY_IPV6_NS[@]}")
|
||||
echo " static domain_name_servers=${var_supersede_ipv6}" >> "${TARGET}/etc/dhcpcd.conf"
|
||||
|
||||
do_log "info" "file_only" "4300() DHCP client configuration for IPv6: '${TARGET}/etc/dhcpcd.conf' configured."
|
||||
do_log "info" "file_only" "4300() DHCP client configuration: '${TARGET}/etc/dhcpcd.conf' configured."
|
||||
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user