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:
@@ -507,9 +507,9 @@ network:
|
||||
ipv4nameserver_fallback:
|
||||
- "176.9.93.198" # dnsforge.de
|
||||
- "176.9.1.117" # dnsforge.de
|
||||
ipv6address: "2a0a:aaaa:bbbb:cccc:192:168:128:128"
|
||||
ipv6netmask: "128"
|
||||
ipv6gateway: "fe80::1"
|
||||
ipv6address: ""
|
||||
ipv6netmask: ""
|
||||
ipv6gateway: ""
|
||||
ipv6nameserver:
|
||||
- "2a01:4f9:c012:a813:135:181:207:105"
|
||||
- "2a0a:4cc0:1:e6:89:58:62:53"
|
||||
|
||||
@@ -52,10 +52,10 @@ yaml_validator() {
|
||||
### Declare Arrays, HashMaps, and Variables.
|
||||
# shellcheck disable=SC2034
|
||||
declare -ag ARY_IPV4_NS=() ARY_IPV6_NS=()
|
||||
declare var_auto_nic="" var_auto_ipv4="" var_auto_ipv4_ccidr="" var_auto_ipv4_subnet="" var_auto_ipv4_gw="" \
|
||||
var_auto_ipv6="" var_auto_ipv6_ccidr="" var_auto_ipv6_gw="" var_link_ipv4="" var_link_ipv6="" var_auto_fqdn=""
|
||||
declare var_auto_nic="" var_auto_ipv4="" var_auto_ipv4_cidr="" var_auto_ipv4_subnet="" var_auto_ipv4_gw="" \
|
||||
var_auto_ipv6="" var_auto_ipv6_cidr="" var_auto_ipv6_gw="" var_link_ipv4="" var_link_ipv6="" var_auto_fqdn=""
|
||||
declare -gx VAR_FINAL_NIC="" VAR_FINAL_FQDN="" VAR_FINAL_IPV4="" VAR_FINAL_IPV4_GW="" VAR_FINAL_IPV4_SUBNET="" \
|
||||
VAR_FINAL_IPV6="" VAR_LINK_IPV6="" VAR_FINAL_IPV6_GW="" VAR_FINAL_IPV6_SUBNET=""
|
||||
VAR_FINAL_IPV6="" VAR_LINK_IPV6="" VAR_FINAL_IPV6_GW="" VAR_FINAL_IPV6_CIDR=""
|
||||
|
||||
ensure_lowercase "network_autoconfig_enable"
|
||||
ensure_lowercase "network_choose_interface_auto"
|
||||
@@ -93,24 +93,24 @@ yaml_validator() {
|
||||
var_auto_nic=$(ip -o link show | awk -F': ' '/state UP/ && $2!="lo" {print $2; exit}')
|
||||
|
||||
# shellcheck disable=SC2312
|
||||
var_auto_ipv4_ccidr=$(ip -4 -o addr show "${var_auto_nic}" | awk '{print $4; exit}')
|
||||
var_auto_ipv4_cidr=$(ip -4 -o addr show "${var_auto_nic}" | awk '{print $4; exit}')
|
||||
|
||||
# shellcheck disable=SC2312
|
||||
var_auto_ipv4_subnet=$(generate_subnetmask "${var_auto_ipv4_ccidr}")
|
||||
var_auto_ipv4_subnet=$(generate_subnetmask "${var_auto_ipv4_cidr}")
|
||||
|
||||
# shellcheck disable=SC2312
|
||||
var_auto_ipv4=$(echo "${var_auto_ipv4_ccidr}" | awk -F'/' '{print $1}')
|
||||
var_auto_ipv4=$(echo "${var_auto_ipv4_cidr}" | awk -F'/' '{print $1}')
|
||||
|
||||
# shellcheck disable=SC2312
|
||||
var_auto_ipv4_gw=$(ip route show default dev "${var_auto_nic}" | awk '/^default/ {print $3; exit}')
|
||||
|
||||
# shellcheck disable=SC2312
|
||||
var_auto_ipv6_ccidr=$(ip -6 -o addr show "${var_auto_nic}" | awk '/scope global/ {print $4; exit}')
|
||||
var_auto_ipv6_cidr=$(ip -6 -o addr show "${var_auto_nic}" | awk '/scope global/ {print $4; exit}')
|
||||
|
||||
if [[ -n "${var_auto_ipv6_ccidr}" ]]; then
|
||||
if [[ -n "${var_auto_ipv6_cidr}" ]]; then
|
||||
|
||||
# shellcheck disable=SC2312
|
||||
var_auto_ipv6=$(echo "${var_auto_ipv6_ccidr}" | awk -F'/' '{print $1}')
|
||||
var_auto_ipv6=$(echo "${var_auto_ipv6_cidr}" | awk -F'/' '{print $1}')
|
||||
# shellcheck disable=SC2312
|
||||
var_auto_ipv6_gw=$(ip -6 route show default dev "${var_auto_nic}" | awk '/^default/ {print $3; exit}')
|
||||
|
||||
@@ -132,18 +132,18 @@ yaml_validator() {
|
||||
|
||||
do_log "info" "file_only" "1252() Live environment network check: Auto NIC ='${var_auto_nic}'."
|
||||
do_log "info" "file_only" "1252() Live environment network check: Auto IPv4 ='${var_auto_ipv4}'."
|
||||
do_log "info" "file_only" "1252() Live environment network check: Auto IPv4 CCIDR ='${var_auto_ipv4_ccidr}'."
|
||||
do_log "info" "file_only" "1252() Live environment network check: Auto IPv4 CCIDR ='${var_auto_ipv4_cidr}'."
|
||||
do_log "info" "file_only" "1252() Live environment network check: Auto IPv4 Subnet ='${var_auto_ipv4_subnet}'."
|
||||
do_log "info" "file_only" "1252() Live environment network check: Auto IPv4 Gateway ='${var_auto_ipv4_gw}'."
|
||||
do_log "info" "file_only" "1252() Live environment network check: Auto IPv6 ='${var_auto_ipv6}'."
|
||||
do_log "info" "file_only" "1252() Live environment network check: Auto IPv6 CCIDR ='${var_auto_ipv6_ccidr}'."
|
||||
do_log "info" "file_only" "1252() Live environment network check: Auto IPv6 CCIDR ='${var_auto_ipv6_cidr}'."
|
||||
do_log "info" "file_only" "1252() Live environment network check: Auto IPv6 Gateway ='${var_auto_ipv6_gw}'."
|
||||
do_log "info" "file_only" "1252() Live environment network check: Auto IPv4 Link ='${var_link_ipv4}'."
|
||||
do_log "info" "file_only" "1252() Live environment network check: Auto IPv6 Link ='${var_link_ipv6}'."
|
||||
do_log "info" "file_only" "1252() Live environment network check: Auto FQDN ='${var_auto_fqdn}'."
|
||||
|
||||
### Export hostname and IPv4 and IPv6 addresses for further processing according to dynamic results and preseed.yaml settings.
|
||||
if [[ "${network_autoconfig_enable}" == "true" ]]; then
|
||||
if [[ "${network_autoconfig_enable}" == "true" && -z "${network_static_ipv4address}" ]]; then
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
VAR_FINAL_NIC="${var_auto_nic}"
|
||||
@@ -156,9 +156,9 @@ yaml_validator() {
|
||||
# shellcheck disable=SC2034
|
||||
VAR_FINAL_IPV4_SUBNET="${var_auto_ipv4_subnet}"
|
||||
|
||||
do_log "info" "file_only" "1252() Network IPv4 autoconfiguration: [${network_autoconfig_enable}]."
|
||||
do_log "info" "file_only" "1252() Network IPv4 auto configuration: [${network_autoconfig_enable}] and IPv4 Link: [${var_link_ipv4}]."
|
||||
|
||||
else
|
||||
elif [[ "${network_autoconfig_enable}" == "false" && -n "${network_static_ipv4address}" ]]; then
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
VAR_FINAL_NIC="${network_choose_interface_static}"
|
||||
@@ -171,11 +171,11 @@ yaml_validator() {
|
||||
# shellcheck disable=SC2034
|
||||
VAR_FINAL_IPV4_SUBNET="${network_static_ipv4netmask}"
|
||||
|
||||
do_log "info" "file_only" "1252() Network IPv4 autoconfiguration: [${network_autoconfig_enable}]."
|
||||
do_log "info" "file_only" "1252() Network IPv4 static configuration: [${network_static_ipv4address}] and IPv4 Link: [${var_link_ipv4}]."
|
||||
|
||||
fi
|
||||
|
||||
if [[ "${network_autoconfig_enable}" == "true" ]]; then
|
||||
if [[ "${var_link_ipv6}" == "true" && "${network_autoconfig_enable}" == "true" && "${network_ipv6}" == "true" && -z "${network_static_ipv6address}" ]]; then
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
VAR_FINAL_IPV6="${var_auto_ipv6}"
|
||||
@@ -184,28 +184,28 @@ yaml_validator() {
|
||||
# shellcheck disable=SC2034
|
||||
VAR_FINAL_IPV6_GW="${var_auto_ipv6_gw}"
|
||||
# shellcheck disable=SC2034
|
||||
VAR_FINAL_IPV6_SUBNET="${var_auto_ipv6_ccidr}"
|
||||
VAR_FINAL_IPV6_CIDR="${var_auto_ipv6_cidr}"
|
||||
|
||||
do_log "info" "file_only" "1252() Network IPv6 auto configuration: [${network_autoconfig_enable}] and IPv6 Link: [${var_link_ipv6}]."
|
||||
|
||||
elif [[ "${network_autoconfig_enable}" == "false" && -n "${network_static_ipv6address}" ]]; then
|
||||
elif [[ -n "${network_static_ipv6address}" ]]; then
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
VAR_LINK_IPV6="${var_link_ipv6}"
|
||||
# shellcheck disable=SC2034
|
||||
VAR_FINAL_IPV6="${network_static_ipv6address}"
|
||||
# shellcheck disable=SC2034
|
||||
VAR_LINK_IPV6="${var_link_ipv6}"
|
||||
# shellcheck disable=SC2034
|
||||
VAR_FINAL_IPV6_GW="${network_static_ipv6gateway}"
|
||||
# shellcheck disable=SC2034
|
||||
VAR_FINAL_IPV6_SUBNET="${network_static_ipv6netmask}"
|
||||
VAR_FINAL_IPV6_CIDR="${network_static_ipv6address}/${network_static_ipv6netmask}"
|
||||
|
||||
do_log "info" "file_only" "1252() Network IPv6 autoconfiguration: [${network_autoconfig_enable}] and IPv6 static: [${network_static_ipv6address}]."
|
||||
do_log "info" "file_only" "1252() Network IPv6 static configuration: [${network_static_ipv6address}] and IPv6 Link: [${var_link_ipv6}]."
|
||||
|
||||
else
|
||||
|
||||
# shellcheck disable=SC2034
|
||||
VAR_FINAL_IPV6=""
|
||||
do_log "info" "file_only" "1252() Network IPv6 autoconfiguration: no IPv6 configuration applied."
|
||||
do_log "info" "file_only" "1252() Network IPv6: no IPv6 configuration applied."
|
||||
|
||||
fi
|
||||
|
||||
|
||||
@@ -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