extension: net: Refactor, fix and improve network extensions

- Rename extensions with "net-*" prefix
- Put the extensions into their own folder
- Split off time sync packages into their own extensions to be able to be used separately
- Put their config files into directories instead of using inline `cat <<- EOF >`
- Move some other NetworkManager related stuff into the extension
- Remove unneeded steps
- Install iproute2 by default on all images (for the `ip` command)
This commit is contained in:
ColorfulRhino
2024-06-19 13:59:06 +02:00
committed by Igor
parent f4b160abde
commit 497c6dce0e
16 changed files with 156 additions and 96 deletions

View File

@@ -61,11 +61,14 @@ function do_main_configuration() {
declare -g SKIP_EXTERNAL_TOOLCHAINS="${SKIP_EXTERNAL_TOOLCHAINS:-yes}" # don't use any external toolchains, by default.
# Network manager for CLI and desktop, systemd-networkd for minimal
# Network-manager and Chrony for standard CLI and desktop, systemd-networkd and systemd-timesyncd for minimal
# systemd-timesyncd is slimmer and less resource intensive than Chrony, see https://unix.stackexchange.com/questions/504381/chrony-vs-systemd-timesyncd-what-are-the-differences-and-use-cases-as-ntp-cli
if [[ ${BUILD_MINIMAL} == yes ]]; then
enable_extension "systemd-neworkd"
enable_extension "net-systemd-neworkd"
enable_extension "net-systemd-timesyncd"
else
enable_extension "network-manager"
enable_extension "net-network-manager"
enable_extension "net-chrony"
fi
# Timezone

View File

@@ -476,6 +476,14 @@ function enable_extension() {
extension_dir="${extension_base_path}" # this is misleading. only directory-based extensions should have this.
extension_file="${extension_floating_file}"
break
else
# Search for the extension file in any subdirectory
extension_file=$(find "${extension_base_path}" -type f -name "${extension_name}.sh" | head -n 1) # Example format: extensions/network/net-network-manager.sh
if [[ -n "${extension_file}" ]]; then
# Extract extension dir from file, e.g. from "extensions/network/net-network-manager.sh" the dir "extensions/network/" gets extracted
extension_dir="${extension_file%/*}"
break
fi
fi
done