summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortorben2018-09-03 19:18:53 +0200
committertorben2018-09-03 19:18:53 +0200
commit48427149f274eed97a60b5180da81a3e27048257 (patch)
tree7d20a8fa94912fd18652b84fda1898534e38d3cd
parentAllow complete dynamically configured systemd-networkd. (diff)
downloadsystemd-init-48427149f274eed97a60b5180da81a3e27048257.tar.gz
systemd-init-48427149f274eed97a60b5180da81a3e27048257.tar.xz
systemd-init-48427149f274eed97a60b5180da81a3e27048257.zip
Improve network device recognation.
-rwxr-xr-xmodules.d/systemd-networkd-ext/hooks/convert-kcl-network-configuration-to-systemd-service-files.sh68
-rwxr-xr-xmodules.d/systemd-networkd-ext/module-setup.sh2
2 files changed, 40 insertions, 30 deletions
diff --git a/modules.d/systemd-networkd-ext/hooks/convert-kcl-network-configuration-to-systemd-service-files.sh b/modules.d/systemd-networkd-ext/hooks/convert-kcl-network-configuration-to-systemd-service-files.sh
index 62e5608a..410a890e 100755
--- a/modules.d/systemd-networkd-ext/hooks/convert-kcl-network-configuration-to-systemd-service-files.sh
+++ b/modules.d/systemd-networkd-ext/hooks/convert-kcl-network-configuration-to-systemd-service-files.sh
@@ -118,20 +118,18 @@ generate_networkd_config() {
if [[ "$BOOTIF" != false ]]; then
local BOOTIF_NETWORK_CONF="/etc/systemd/network/$BOOTIF_NAME.network"
(
- echo [Match]
- if [[ "$BOOTIF" != '' ]]; then
- echo "MACAddress=$BOOTIF"
- fi
- #echo 'Path=pci*'
- echo 'Path=enp*'
- echo
# Currently the boot interface is configured to either:
# * static ip as given by the initial DHCP during PXE
# * bridged
# * vlan-tagged (ethernet interface not configured)
# In particular, configuring both vlan tags and the physical
# interface is not supported (might be needed in some setups)
- echo [Network]
+ cat << EOF
+[Match]
+Name=$BOOTIF_NAME
+
+[Network]
+EOF
if [[ "$BRIDGED" != '' ]]; then
echo "Bridge=${BRIDGE_NAME}"
elif [ -n "$CLIENT_IP" -a -n "$GATEWAY_IP" ]; then
@@ -175,21 +173,18 @@ EOF
else
local WIRELESS_BOOTIF_NETWORK_CONF="/etc/systemd/network/$WIRELESS_BOOTIF_NAME.network"
(
- echo [Match]
- if [[ "$WIRELESS_BOOTIF" != '' ]]; then
- echo "MACAddress=$WIRELESS_BOOTIF"
- fi
- echo 'Path=wlp*'
- echo
# Currently the boot interface is configured to either:
# * static ip as given by the initial DHCP during PXE
# * bridged
# * vlan-tagged (ethernet interface not configured)
# In particular, configuring both vlan tags and the physical
# interface is not supported (might be needed in some setups)
- echo [Network]
- echo DHCP=ipv4
cat << EOF
+[Match]
+Name=$WIRELESS_BOOTIF_NAME
+
+[Network]
+DHCP=ipv4
LinkLocalAddressing=no
IPv6AcceptRA=no
@@ -200,14 +195,20 @@ UseHostname=true
CriticalConnection=true
EOF
) > "$WIRELESS_BOOTIF_NETWORK_CONF"
- cat << EOF > "/etc/systemd/network/$WIRELESS_BOOTIF_NAME.link"
-[Match]
-MACAddress=$WIRELESS_BOOTIF
+ (
+ echo [Match]
+ if [[ "$WIRELESS_BOOTIF" != '' ]]; then
+ echo "MACAddress=$WIRELESS_BOOTIF"
+ else
+ echo 'Path=wlp*'
+ fi
+ cat << EOF
[Link]
Description=Critical wireless network device.
Name=$WIRELESS_BOOTIF_NAME
EOF
+ ) > "/etc/systemd/network/$WIRELESS_BOOTIF_NAME.link"
fi
if [[ "$VLAN" != '' ]]; then
local VLAN_DEV_CONF="/etc/systemd/network/$BOOTIF_NAME.$VLAN.netdev"
@@ -302,17 +303,26 @@ parse_kernel_command_line
# Save IP config for later use
save_ip_config
-# Create the udev rule to rename the boot interface to the declared BOOTIF_NAME
-# Create udev rule to rename the PXE boot interface to BOOTIF_NAME
-if [[ "$BOOTIF" != '' ]] && [[ "$BOOTIF" != false ]]; then
- # priority 70 < 80-net-name-slot.rules.
- echo 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="'$BOOTIF'", NAME="'$BOOTIF_NAME'"' \
- > /etc/udev/rules.d/70-pxe-boot-interface.rules
+# NOTE: priority 70 < 80-net-name-slot.rules.
+if [[ "$BOOTIF" != false ]]; then
+ # Create the udev rule to rename the boot interface to the declared BOOTIF_NAME
+ if [ "$BOOTIF" = '' ]; then
+ echo 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", NAME=="enp*", NAME="'$BOOTIF_NAME'"' \
+ > /etc/udev/rules.d/70-pxe-boot-interface.rules
+ else
+ echo 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="'$BOOTIF'", NAME="'$BOOTIF_NAME'"' \
+ > /etc/udev/rules.d/70-pxe-boot-interface.rules
+ fi
fi
-if [[ "$WIRELESS_BOOTIF" != '' ]] && [[ "$WIRELESS_BOOTIF" != false ]]; then
- # priority 70 < 80-net-name-slot.rules.
- echo 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="'$WIRELESS_BOOTIF'", NAME="'$WIRELESS_BOOTIF_NAME'"' \
- > /etc/udev/rules.d/70-pxe-wireless-boot-interface.rules
+if [[ "$WIRELESS_BOOTIF" != false ]]; then
+ # Create udev rule to rename the specifief wireless boot interface to WIRELESS_BOOTIF_NAME
+ if [ "$WIRELESS_BOOTIF" = '' ]; then
+ echo 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", NAME=="wlp*", NAME="'$WIRELESS_BOOTIF_NAME'"' \
+ > /etc/udev/rules.d/70-pxe-wireless-boot-interface.rules
+ else
+ echo 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="'$WIRELESS_BOOTIF'", NAME="'$WIRELESS_BOOTIF_NAME'"' \
+ > /etc/udev/rules.d/70-pxe-wireless-boot-interface.rules
+ fi
fi
# Generate config files for networkd
diff --git a/modules.d/systemd-networkd-ext/module-setup.sh b/modules.d/systemd-networkd-ext/module-setup.sh
index 38bb2014..0f982924 100755
--- a/modules.d/systemd-networkd-ext/module-setup.sh
+++ b/modules.d/systemd-networkd-ext/module-setup.sh
@@ -26,10 +26,10 @@ check() {
# called by dracut
depends() {
+ # TODO not needed for tests: dialog \
echo \
bashlink \
custom-logging \
- dialog \
kernel-network-modules \
systemd
}