Move Network Manager bits into extensions

- use Chrony with Network Manager
- use timesync with systemd-networkd
- use NetPlan with Network manager only
- move command-not-found to CLI image only
- improve firstlogin ip detection
This commit is contained in:
Igor Pecovnik
2024-06-17 16:08:32 +02:00
committed by Igor
parent e0762bbbb7
commit f4b160abde
42 changed files with 141 additions and 209 deletions

View File

@@ -1,8 +1,6 @@
alsa-utils
bc
bridge-utils
chrony
command-not-found
console-setup
cron
curl
@@ -30,8 +28,6 @@ man-db
mmc-utils
ncurses-term
nano
netplan.io
network-manager
openssh-server
parted
psmisc

View File

@@ -1,9 +1,6 @@
alsa-utils
bash-completion
bc
bridge-utils
chrony
command-not-found
console-setup
cron
curl
@@ -11,15 +8,13 @@ dbus-user-session
dialog
debconf-utils
debsums
device-tree-compiler
dosfstools
ethtool
fake-hwclock
fdisk
figlet
htop
inetutils-ping
init
inetutils-ping
initramfs-tools
iw
jq
@@ -31,8 +26,6 @@ man-db
mmc-utils
ncurses-term
nano
netplan.io
network-manager
openssh-server
parted
psmisc
@@ -40,13 +33,10 @@ rsync
rsyslog
sudo
systemd-resolved
sysfsutils
sysstat
toilet
tzdata
u-boot-tools
usbutils
vlan
wget
wireless-tools
wireguard-tools

View File

@@ -6,8 +6,11 @@ avahi-autoipd
bison
btrfs-progs
build-essential
command-not-found
cracklib-runtime
device-tree-compiler
dkms
ethtool
evtest
expect
f2fs-tools
@@ -36,7 +39,6 @@ libpam-systemd
libproc-processtable-perl
libwrap0-dev
mc
network-manager-openvpn
nfs-common
ntfs-3g
pciutils
@@ -50,7 +52,8 @@ screen
software-properties-common
smartmontools
stress
sudo
sysfsutils
sysstat
unattended-upgrades
unicode-data
unzip

View File

@@ -1,8 +1,6 @@
alsa-utils
bc
bridge-utils
chrony
command-not-found
console-setup
cron
curl
@@ -30,8 +28,6 @@ man-db
mmc-utils
ncurses-term
nano
netplan.io
network-manager
openssh-server
parted
psmisc

View File

@@ -37,7 +37,6 @@ libpam-systemd
libproc-processtable-perl
libwrap0-dev
mc
network-manager-openvpn
nfs-common
ntfs-3g
pciutils

View File

@@ -37,7 +37,6 @@ libpam-systemd
libproc-processtable-perl
libwrap0-dev
mc
network-manager-openvpn
nfs-common
ntfs-3g
pciutils

View File

@@ -37,7 +37,6 @@ libpam-systemd
libproc-processtable-perl
libwrap0-dev
mc
network-manager-openvpn
nfs-common
ntfs-3g
pciutils

View File

@@ -88,7 +88,6 @@ libnotify-bin
libplank1
libplank-common
libproxy1-plugin-gsettings
libproxy1-plugin-networkmanager
libwmf0.2-7-gtk
libxapp1
libxcursor1
@@ -101,9 +100,6 @@ nemo-data
nemo-fileroller
nemo-font-manager
nemo-gtkhash
network-manager-openvpn
network-manager-ssh
network-manager-vpnc
numix-gtk-theme
numix-icon-theme
numix-icon-theme-circle

View File

@@ -76,10 +76,6 @@ nemo-data
nemo-fileroller
nemo-font-manager
nemo-gtkhash
network-manager-gnome
network-manager-openvpn
network-manager-ssh
network-manager-vpnc
numix-gtk-theme
numix-icon-theme
numix-icon-theme-circle

View File

@@ -30,8 +30,6 @@ libpulsedsp
gdm3
lm-sensors
nautilus
network-manager-gnome
network-manager-openvpn-gnome
pavucontrol
#printer-driver-all
profile-sync-daemon

View File

@@ -77,7 +77,6 @@ libgsettings-qt1
libjson-xs-perl
libnotify-bin
libproxy1-plugin-gsettings
libproxy1-plugin-networkmanager
libwmf0.2-7-gtk
libxcb-cursor0
libxcursor1
@@ -87,8 +86,6 @@ lightdm-gtk-greeter-settings
lightdm-settings
lxappearance
mousetweaks
network-manager-openvpn-gnome
network-manager-vpnc
nitrogen
numix-gtk-theme
openprinting-ppds

View File

@@ -61,16 +61,12 @@ libgsettings-qt1
libgtk2.0-bin
libnotify-bin
libproxy1-plugin-gsettings
libproxy1-plugin-networkmanager
libwmf0.2-7-gtk
libxcursor1
sddm
mesa-utils
mousepad
mousetweaks
network-manager-openvpn
network-manager-ssh
network-manager-vpnc
numix-gtk-theme
numix-icon-theme
numix-icon-theme-circle

View File

@@ -76,7 +76,6 @@ mate-window-applets-common
mate-window-buttons-applet
mate-window-menu-applet
mate-window-title-applet
network-manager-gnome
numix-gtk-theme
numix-icon-theme
numix-icon-theme-circle

View File

@@ -52,7 +52,6 @@ libgtk2.0-bin
libnotify-bin
libpam-gnome-keyring
libproxy1-plugin-gsettings
libproxy1-plugin-networkmanager
libwmf0.2-7-gtk
libxcursor1
lightdm
@@ -61,10 +60,6 @@ lxtask
mesa-utils
mousepad
mousetweaks
network-manager-gnome
network-manager-openvpn
network-manager-ssh
network-manager-vpnc
numix-gtk-theme
numix-icon-theme
numix-icon-theme-circle

View File

@@ -64,7 +64,6 @@ libgnome-bluetooth13
libgsettings-qt1
libnotify-bin
libproxy1-plugin-gsettings
libproxy1-plugin-networkmanager
libwmf0.2-7-gtk
libxapp1
libxcursor1
@@ -73,8 +72,6 @@ lightdm-gtk-greeter
lightdm-gtk-greeter-settings
lightdm-settings
mousetweaks
network-manager-openvpn-gnome
network-manager-vpnc
nitrogen
numix-gtk-theme
openprinting-ppds

View File

@@ -109,7 +109,6 @@ libnotify-bin
libplank1
libplank-common
libproxy1-plugin-gsettings
libproxy1-plugin-networkmanager
libwmf0.2-7-gtk
libxcursor1
gdm3
@@ -121,10 +120,6 @@ nemo-data
nemo-fileroller
nemo-font-manager
nemo-gtkhash
network-manager-config-connectivity-ubuntu
network-manager-openvpn
network-manager-ssh
network-manager-vpnc
numix-blue-gtk-theme
numix-gtk-theme
numix-icon-theme

View File

@@ -80,10 +80,6 @@ nemo-data
nemo-fileroller
nemo-font-manager
nemo-gtkhash
network-manager-gnome
network-manager-openvpn
network-manager-ssh
network-manager-vpnc
numix-gtk-theme
numix-icon-theme
numix-icon-theme-circle

View File

@@ -119,7 +119,6 @@ libgsettings-qt1
libgtk2.0-bin
libnotify-bin
libproxy1-plugin-gsettings
libproxy1-plugin-networkmanager
libwmf0.2-7-gtk
libxcursor1
lightdm
@@ -128,10 +127,6 @@ lxtask
mesa-utils
mousepad
mousetweaks
network-manager-config-connectivity-ubuntu
network-manager-openvpn
network-manager-ssh
network-manager-vpnc
numix-blue-gtk-theme
numix-gtk-theme
numix-icon-theme

View File

@@ -85,7 +85,6 @@ libnotify-bin
libplank1
libplank-common
libproxy1-plugin-gsettings
libproxy1-plugin-networkmanager
libwmf0.2-7-gtk
libxcursor1
lightdm
@@ -93,10 +92,6 @@ lxtask
mesa-utils
mousepad
mousetweaks
network-manager-config-connectivity-ubuntu
network-manager-openvpn
network-manager-ssh
network-manager-vpnc
numix-blue-gtk-theme
numix-gtk-theme
numix-icon-theme

View File

@@ -30,8 +30,6 @@ libnotify-bin
gdm3
lm-sensors
nautilus
network-manager-gnome
network-manager-openvpn-gnome
pavucontrol
printer-driver-all
profile-sync-daemon

View File

@@ -81,7 +81,6 @@ libgsettings-qt1
libjson-xs-perl
libnotify-bin
libproxy1-plugin-gsettings
libproxy1-plugin-networkmanager
libwmf0.2-7-gtk
libxcb-cursor0
libxcursor1
@@ -91,8 +90,6 @@ lightdm-gtk-greeter-settings
lightdm-settings
lxappearance
mousetweaks
network-manager-openvpn-gnome
network-manager-vpnc
nitrogen
numix-gtk-theme
openprinting-ppds

View File

@@ -81,17 +81,12 @@ libgsettings-qt1
libgtk2.0-bin
libnotify-bin
libproxy1-plugin-gsettings
libproxy1-plugin-networkmanager
libwmf0.2-7-gtk
libxcursor1
sddm
mesa-utils
mousepad
mousetweaks
network-manager-config-connectivity-ubuntu
network-manager-openvpn
network-manager-ssh
network-manager-vpnc
numix-gtk-theme
numix-icon-theme
numix-icon-theme-circle

View File

@@ -81,7 +81,6 @@ libgsettings-qt1
libgtk2.0-bin
libnotify-bin
libproxy1-plugin-gsettings
libproxy1-plugin-networkmanager
libwmf0.2-7-gtk
libxcursor1
lightdm
@@ -149,10 +148,6 @@ mate-window-title-applet
mesa-utils
mousepad
mousetweaks
network-manager-config-connectivity-ubuntu
network-manager-openvpn
network-manager-ssh
network-manager-vpnc
numix-gtk-theme
numix-icon-theme
numix-icon-theme-circle

View File

@@ -52,7 +52,6 @@ libgtk2.0-bin
libnotify-bin
libpam-gnome-keyring
libproxy1-plugin-gsettings
libproxy1-plugin-networkmanager
libwmf0.2-7-gtk
libxcursor1
lightdm
@@ -61,10 +60,6 @@ lxtask
mesa-utils
mousepad
mousetweaks
network-manager-gnome
network-manager-openvpn
network-manager-ssh
network-manager-vpnc
numix-gtk-theme
numix-icon-theme
numix-icon-theme-circle

View File

@@ -73,7 +73,6 @@ libgnome-bluetooth13
libgsettings-qt1
libnotify-bin
libproxy1-plugin-gsettings
libproxy1-plugin-networkmanager
libwmf0.2-7-gtk
libxcursor1
lightdm
@@ -81,8 +80,6 @@ lightdm-gtk-greeter
lightdm-gtk-greeter-settings
lightdm-settings
mousetweaks
network-manager-openvpn-gnome
network-manager-vpnc
nitrogen
numix-gtk-theme
openprinting-ppds

View File

@@ -108,7 +108,6 @@ libnotify-bin
libplank1
libplank-common
libproxy1-plugin-gsettings
libproxy1-plugin-networkmanager
libu2f-udev
libwmf0.2-7-gtk
libxapp1
@@ -122,10 +121,6 @@ nemo-data
nemo-fileroller
nemo-font-manager
nemo-gtkhash
network-manager-config-connectivity-ubuntu
network-manager-openvpn
network-manager-ssh
network-manager-vpnc
numix-gtk-theme
numix-icon-theme
numix-icon-theme-circle

View File

@@ -80,10 +80,6 @@ nemo-data
nemo-fileroller
nemo-font-manager
nemo-gtkhash
network-manager-gnome
network-manager-openvpn
network-manager-ssh
network-manager-vpnc
numix-gtk-theme
numix-icon-theme
numix-icon-theme-circle

View File

@@ -34,8 +34,6 @@ libpulsedsp
gdm3
lm-sensors
nautilus
network-manager-gnome
network-manager-openvpn-gnome
pavucontrol
printer-driver-all
profile-sync-daemon

View File

@@ -79,7 +79,6 @@ libgsettings-qt1
libjson-xs-perl
libnotify-bin
libproxy1-plugin-gsettings
libproxy1-plugin-networkmanager
libu2f-udev
libwmf0.2-7-gtk
libxcb-cursor0
@@ -90,8 +89,6 @@ lightdm-gtk-greeter-settings
lightdm-settings
lxappearance
mousetweaks
network-manager-openvpn-gnome
network-manager-vpnc
nitrogen
numix-gtk-theme
openprinting-ppds

View File

@@ -80,7 +80,6 @@ libgsettings-qt1
libgtk2.0-bin
libnotify-bin
libproxy1-plugin-gsettings
libproxy1-plugin-networkmanager
libu2f-udev
libwmf0.2-7-gtk
libxcursor1
@@ -88,10 +87,6 @@ sddm
mesa-utils
mousepad
mousetweaks
network-manager-config-connectivity-ubuntu
network-manager-openvpn
network-manager-ssh
network-manager-vpnc
numix-gtk-theme
numix-icon-theme
numix-icon-theme-circle

View File

@@ -74,7 +74,6 @@ mate-window-applets-common
mate-window-buttons-applet
mate-window-menu-applet
mate-window-title-applet
network-manager-gnome
numix-gtk-theme
numix-icon-theme
numix-icon-theme-circle

View File

@@ -53,7 +53,6 @@ libgtk2.0-bin
libnotify-bin
libpam-gnome-keyring
libproxy1-plugin-gsettings
libproxy1-plugin-networkmanager
libu2f-udev
libwmf0.2-7-gtk
libxcursor1
@@ -63,10 +62,6 @@ lxtask
mesa-utils
mousepad
mousetweaks
network-manager-gnome
network-manager-openvpn
network-manager-ssh
network-manager-vpnc
numix-gtk-theme
numix-icon-theme
numix-icon-theme-circle

View File

@@ -74,7 +74,6 @@ libgnome-bluetooth13
libgsettings-qt1
libnotify-bin
libproxy1-plugin-gsettings
libproxy1-plugin-networkmanager
libu2f-udev
libwmf0.2-7-gtk
libxapp1
@@ -84,8 +83,6 @@ lightdm-gtk-greeter
lightdm-gtk-greeter-settings
lightdm-settings
mousetweaks
network-manager-openvpn-gnome
network-manager-vpnc
nitrogen
numix-gtk-theme
openprinting-ppds

View File

@@ -75,7 +75,6 @@ libgsettings-qt1
libjson-xs-perl
libnotify-bin
libproxy1-plugin-gsettings
libproxy1-plugin-networkmanager
libu2f-udev
libwmf0.2-7-gtk
libxcb-cursor0
@@ -86,8 +85,6 @@ lightdm-gtk-greeter-settings
lightdm-settings
lxappearance
mousetweaks
network-manager-openvpn-gnome
network-manager-vpnc
nitrogen
numix-gtk-theme
openprinting-ppds

View File

@@ -52,7 +52,6 @@ libgtk2.0-bin
libnotify-bin
libpam-gnome-keyring
libproxy1-plugin-gsettings
libproxy1-plugin-networkmanager
libu2f-udev
libwmf0.2-7-gtk
libxcursor1
@@ -62,10 +61,6 @@ lxtask
mesa-utils
mousepad
mousetweaks
network-manager-gnome
network-manager-openvpn
network-manager-ssh
network-manager-vpnc
numix-gtk-theme
numix-icon-theme
numix-icon-theme-circle

13
extensions/ifupdown2.sh Normal file
View File

@@ -0,0 +1,13 @@
#
# Extension for ifupdown2
#
function add_host_dependencies__install_ifupdown2() {
display_alert "Adding Netplan to systemd-networkd" "systemd-timesyncd" "info"
add_packages_to_rootfs ifupdown2 iproute2 bridge-utils vlan
}
function pre_install_kernel_debs__configure_systemd_networkd()
{
display_alert "${EXTENSION}: enabling ifupdown2" "" "info"
}

View File

@@ -0,0 +1,48 @@
#
# Extension for Network Manager + Netplan + Chrony
#
function add_host_dependencies__install_network_manager() {
display_alert "Adding Networking manager related packages" "network-manager network-manager-openvpn" "info"
add_packages_to_rootfs network-manager network-manager-openvpn netplan.io chrony
if [[ "${BUILD_DESKTOP}" == "yes" ]]; then
add_packages_to_rootfs network-manager-gnome network-manager-ssh network-manager-vpnc
fi
if [[ "${DISTRIBUTION}" == "Ubuntu" ]]; then
add_packages_to_rootfs network-manager-config-connectivity-ubuntu
fi
}
function pre_install_kernel_debs__configure_network_manager()
{
display_alert "${EXTENSION}: enabling Network Manager" "" "info"
# configure network manager
sed "s/managed=\(.*\)/managed=true/g" -i "${SDCARD}"/etc/NetworkManager/NetworkManager.conf
## remove network manager defaults to handle eth by default @TODO: why?
# rm -f "${SDCARD}"/usr/lib/NetworkManager/conf.d/10-globally-managed-devices.conf
# `systemd-networkd.service` will be enabled by `/lib/systemd/system-preset/90-systemd.preset` during first-run.
# Mask it to avoid conflict
chroot_sdcard systemctl mask systemd-networkd.service
# most likely we don't need to wait for nm to get online
chroot_sdcard systemctl disable NetworkManager-wait-online.service
if [[ -n $NM_IGNORE_DEVICES ]]; then
mkdir -p "${SDCARD}"/etc/NetworkManager/conf.d/
cat <<- EOF > "${SDCARD}"/etc/NetworkManager/conf.d/10-ignore-interfaces.conf
[keyfile]
unmanaged-devices=$NM_IGNORE_DEVICES
EOF
fi
# Let NetworkManager manage all devices on this system by default
cat <<- EOF > "${SDCARD}"/etc/netplan/armbian-default.yaml
# This installation supports NetworkManager renderer only. You need to install additional packages in case you want something else
network:
version: 2
renderer: NetworkManager
EOF
}

View File

@@ -0,0 +1,44 @@
#
# Extension for systemd-networkd + systemd-timesyncd
#
function add_host_dependencies__install_network_manager() {
display_alert "Extension: ${EXTENSION}: install additional packages" "iproute2 systemd-timesyncd netplan.io" "info"
add_packages_to_rootfs iproute2 systemd-timesyncd netplan.io
}
function pre_install_kernel_debs__configure_systemd_networkd()
{
display_alert "Extension: ${EXTENSION}: enabling systemd-networkd" "" "info"
# remove default interfaces file if present
rm -f "${SDCARD}"/etc/network/interfaces
# enable networkd
chroot_sdcard systemctl enable systemd-networkd.service || display_alert "Failed to enable systemd-networkd.service" "" "wrn"
# enable resolved too
chroot_sdcard systemctl enable systemd-resolved.service || display_alert "Failed to enable systemd-resolved.service" "" "wrn"
# Mask `NetworkManager.service` to avoid conflict just to make sure
chroot_sdcard systemctl mask NetworkManager.service
# Enable timesyncd
display_alert "${EXTENSION}: enabling systemd-timesyncd" "" "info"
chroot_sdcard systemctl enable systemd-timesyncd.service
# Let's have DHCP on all network devices
cat <<- EOF > "${SDCARD}"/etc/netplan/armbian-default.yaml
# This installation supports systemd-networkd renderer only. You need to install additional packages in case you want something else
network:
version: 2
renderer: networkd
ethernets:
alleths:
match:
name: e*
dhcp4: true
EOF
# Fix NetPlan permission issue
chmod 600 "${SDCARD}"/etc/netplan/armbian-default.yaml
}

View File

@@ -61,6 +61,13 @@ 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
if [[ ${BUILD_MINIMAL} == yes ]]; then
enable_extension "systemd-neworkd"
else
enable_extension "network-manager"
fi
# Timezone
if [[ -f /etc/timezone ]]; then # Timezone for target is taken from host, if it exists.
TZDATA=$(cat /etc/timezone)

View File

@@ -44,10 +44,6 @@ function install_distribution_agnostic() {
GOVERNOR=$GOVERNOR
EOF
# remove default interfaces file if present
# before installing board support package
rm -f "${SDCARD}"/etc/network/interfaces
# disable selinux by default
mkdir -p "${SDCARD}"/selinux
[[ -f "${SDCARD}"/etc/selinux/config ]] && sed "s/^SELINUX=.*/SELINUX=disabled/" -i "${SDCARD}"/etc/selinux/config
@@ -495,62 +491,6 @@ function install_distribution_agnostic() {
# enable PubkeyAuthentication
sed -i 's/#\?PubkeyAuthentication .*/PubkeyAuthentication yes/' "${SDCARD}"/etc/ssh/sshd_config
if [[ -f "${SDCARD}"/etc/NetworkManager/NetworkManager.conf ]]; then
# configure network manager
sed "s/managed=\(.*\)/managed=true/g" -i "${SDCARD}"/etc/NetworkManager/NetworkManager.conf
## remove network manager defaults to handle eth by default @TODO: why?
rm -f "${SDCARD}"/usr/lib/NetworkManager/conf.d/10-globally-managed-devices.conf
# `systemd-networkd.service` will be enabled by `/lib/systemd/system-preset/90-systemd.preset` during first-run.
# Mask it to avoid conflict
chroot_sdcard systemctl mask systemd-networkd.service
# most likely we don't need to wait for nm to get online
chroot_sdcard systemctl disable NetworkManager-wait-online.service
# Just regular DNS and maintain /etc/resolv.conf as a file @TODO: this does not apply as of impish at least
sed "/dns/d" -i "${SDCARD}"/etc/NetworkManager/NetworkManager.conf
sed "s/\[main\]/\[main\]\ndns=default\nrc-manager=file/g" -i "${SDCARD}"/etc/NetworkManager/NetworkManager.conf
if [[ -n $NM_IGNORE_DEVICES ]]; then
mkdir -p "${SDCARD}"/etc/NetworkManager/conf.d/
cat <<- EOF > "${SDCARD}"/etc/NetworkManager/conf.d/10-ignore-interfaces.conf
[keyfile]
unmanaged-devices=$NM_IGNORE_DEVICES
EOF
fi
elif [ -d "${SDCARD}"/etc/systemd/network ]; then
# enable services
chroot_sdcard systemctl enable systemd-networkd.service
chroot_sdcard systemctl enable systemd-resolved.service || display_alert "Failed to enable systemd-resolved.service" "" "wrn"
# Mask `NetworkManager.service` to avoid conflict
chroot_sdcard systemctl mask NetworkManager.service
if [ -e "${SDCARD}"/etc/systemd/timesyncd.conf ]; then
chroot_sdcard systemctl enable systemd-timesyncd.service
fi
umask 022
cat > "${SDCARD}"/etc/systemd/network/eth0.network <<- __EOF__
[Match]
Name=eth0
[Network]
#MACAddress=
DHCP=ipv4
LinkLocalAddressing=ipv4
#Address=192.168.1.100/24
#Gateway=192.168.1.1
#DNS=192.168.1.1
#Domains=example.com
NTP=0.pool.ntp.org 1.pool.ntp.org
__EOF__
fi
# avahi daemon defaults if exists
[[ -f "${SDCARD}"/usr/share/doc/avahi-daemon/examples/sftp-ssh.service ]] &&
cp "${SDCARD}"/usr/share/doc/avahi-daemon/examples/sftp-ssh.service "${SDCARD}"/etc/avahi/services/

View File

@@ -28,9 +28,6 @@ function install_distribution_specific() {
sed -i "s/#RateLimitIntervalSec=.*/RateLimitIntervalSec=30s/g" "${SDCARD}"/etc/systemd/journald.conf
sed -i "s/#RateLimitBurst=.*/RateLimitBurst=10000/g" "${SDCARD}"/etc/systemd/journald.conf
# Chrony temporal fix https://bugs.launchpad.net/ubuntu/+source/chrony/+bug/1878005
[[ -f "${SDCARD}"/etc/default/chrony ]] && sed -i '/DAEMON_OPTS=/s/"-F -1"/"-F 0"/' "${SDCARD}"/etc/default/chrony
# disable conflicting services
disable_systemd_service_sdcard ondemand.service
@@ -44,21 +41,6 @@ function install_distribution_specific() {
install_artifact_deb_chroot "armbian-base-files"
fi
# Basic Netplan config. Let NetworkManager/networkd manage all devices on this system
if [[ -d "${SDCARD}"/etc/netplan ]]; then
declare RENDERER=networkd
if [ -d "${SDCARD}"/etc/NetworkManager ]; then
local RENDERER=NetworkManager
fi
cat <<- EOF > "${SDCARD}"/etc/netplan/armbian-default.yaml
network:
version: 2
renderer: ${RENDERER}
EOF
fi
# Set DNS server if systemd-resolved is in use
if [[ -n "$NAMESERVER" && -f "${SDCARD}"/etc/systemd/resolved.conf ]]; then
sed -i "s/#DNS=.*/DNS=$NAMESERVER/g" "${SDCARD}"/etc/systemd/resolved.conf

View File

@@ -210,7 +210,11 @@ set_timezone_and_locales() {
PUBLIC_IP=$(curl --max-time 5 -s https://ipinfo.io/ip)
# Check if we have wireless adaptor
WIFI_DEVICE=$(LC_ALL=C nmcli dev status | grep " wifi " 2> /dev/null)
if command -v nmcli > /dev/null 2>&1; then
WIFI_DEVICE=$(LC_ALL=C nmcli dev status | grep " wifi " 2> /dev/null)
elif command -v iw > /dev/null 2>&1; then
WIFI_DEVICE=$(LC_ALL=C iw dev | awk '$1=="Interface"{print $2}' 2> /dev/null)
fi
if [ -z "$PUBLIC_IP" ]; then
@@ -482,8 +486,24 @@ if [[ -f /root/.not_logged_in_yet && -n $(tty) ]]; then
echo -e "Welcome to \e[1m\e[97m${VENDOR}\x1B[0m! \n"
echo -e "Documentation: \e[1m\e[92m${VENDORDOCS}\x1B[0m | Community support: \e[1m\e[92m${VENDORSUPPORT}\x1B[0m\n"
GET_IP=$(bash /etc/update-motd.d/30-armbian-sysinfo | grep IP | sed "s/.*IP://" | sed 's/^[ \t]*//')
[[ -n "$GET_IP" ]] && echo -e "IP address: $GET_IP\n"
echo "" # empty line
# ip server of https://quad9.net/
PingServerAddress="9.9.9.9"
pingcount=11
ping -c 1 ${PingServerAddress} > /dev/null 2>&1
while [ $? -ne 0 -o ${pingcount} -gt 0 ]; do
unset RETRY
pingcount=$(( pingcount - 1 ))
GET_IP=$(ip -4 addr | grep 'state UP' -A2 | tail -n2 | head -n1 | awk '{print $2}' | cut -f1 -d'/')
[[ -z "$GET_IP" ]] && RETRY="\e[1m\e[97mwaiting for connection\x1B[0m! Retrying (${pingcount})"
[[ $pingcount -eq 0 ]] && RETRY="\e[1m\e[31mnetwork connecting timeout\x1B[0m!"
echo -e "\e[1A\e[KIP address: \x1B[92m${GET_IP}\x1B[0m${RETRY}"
[[ -n "$GET_IP" ]] && break
sleep 1
ping -c 1 $PingServerAddress > /dev/null 2>&1
done
echo "" # empty line
trap '' 2
REPEATS=3