[debian-lan-devel] [debian-lan] 01/02: Fixes for fai-cd: Persistent NIC names, add squashfs-tools.

Andreas B. Mundt andi at moszumanska.debian.org
Tue Jan 24 14:03:40 UTC 2017


This is an automated email from the git hooks/post-receive script.

andi pushed a commit to branch master
in repository debian-lan.

commit 93d12385f60298d280c3f350108aab748c14fbac
Author: Andreas B. Mundt <andi at debian.org>
Date:   Tue Jan 24 13:48:52 2017 +0100

    Fixes for fai-cd: Persistent NIC names, add squashfs-tools.
---
 debian/README.Debian                   |  2 +-
 fai/config/hooks/defvar.DEFAULT.sh     | 14 +++++++++++---
 fai/config/scripts/DEBIAN/30-interface |  2 +-
 fai/config/scripts/SERVER_A/10-misc    |  3 +++
 4 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/debian/README.Debian b/debian/README.Debian
index ba4948b..d636428 100644
--- a/debian/README.Debian
+++ b/debian/README.Debian
@@ -21,7 +21,7 @@ Create the CD image in the following way:
 
    apt-get install aptitude  # needed for FAI
    aptitude install debian-lan-config  # might be already installed
-   aptitude -R install fai-server xorriso binutils # no recommends needed
+   aptitude -R install fai-server xorriso binutils squashfs-tools
    mkdir /srv/fai/
    cp -r /usr/share/debian-lan-config/fai/config /srv/fai/
    cp -b /srv/fai/config/files/etc/fai/grub.cfg/SERVER_A /etc/fai/grub.cfg
diff --git a/fai/config/hooks/defvar.DEFAULT.sh b/fai/config/hooks/defvar.DEFAULT.sh
index 9891c3a..dbe4dcc 100755
--- a/fai/config/hooks/defvar.DEFAULT.sh
+++ b/fai/config/hooks/defvar.DEFAULT.sh
@@ -3,9 +3,17 @@
 #   Detect all available NICs
 #
 
-## Variable containing <available network interfaces:
+## Variable containing available network interfaces:
+
 N=0
+fields="ID_NET_NAME_FROM_DATABASE ID_NET_NAME_ONBOARD ID_NET_NAME_SLOT ID_NET_NAME_PATH"
 for NIC in $(ip link show | grep -E "^\w+:" | cut -d ":" -f2 | grep -v lo) ; do
-    echo "NIC_LABEL${N}=$NIC" >> $LOGDIR/additional.var
-    N=$((N+1))
+    for field in $fields; do
+        name=$(udevadm info /sys/class/net/$NIC | sed -rn "s/^E: $field=(.+)/\1/p")
+        if [[ $name ]]; then
+            echo "NIC_LABEL${N}=$name" >> $LOGDIR/additional.var
+            N=$((N+1))
+            break
+        fi
+    done
 done
diff --git a/fai/config/scripts/DEBIAN/30-interface b/fai/config/scripts/DEBIAN/30-interface
index 3474ecd..191561e 100755
--- a/fai/config/scripts/DEBIAN/30-interface
+++ b/fai/config/scripts/DEBIAN/30-interface
@@ -18,7 +18,7 @@ then
       [ -n "$IPADDR" ] && cat > $target/etc/systemd/network/50-static.network <<-EOF
 ## generated by FAI
 [Match]
-Name=$NIC1
+Name=${NIC_LABEL0}
 
 [Network]
 Address=$IPADDR
diff --git a/fai/config/scripts/SERVER_A/10-misc b/fai/config/scripts/SERVER_A/10-misc
index 814e2b9..358d4b6 100755
--- a/fai/config/scripts/SERVER_A/10-misc
+++ b/fai/config/scripts/SERVER_A/10-misc
@@ -41,6 +41,9 @@ fi
 $ROOTCMD sed -i "s/\(^INTERFACESv4=*\)/\#\1/" /etc/default/isc-dhcp-server
 ainsl -v /etc/default/isc-dhcp-server "INTERFACESv4=\"${NIC_LABEL0}\""
 
+## Switch of systemd-networkd:
+$ROOTCMD systemctl disable systemd-networkd
+
 ## Generate '/etc/network/interfaces':
 cat > $target/etc/network/interfaces <<EOF
 # The loopback network interface

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/debian-lan.git



More information about the debian-lan-devel mailing list