static usb ethnet addresses
authorIan Kelling <iank@fsf.org>
Sun, 28 Apr 2024 13:31:36 +0000 (09:31 -0400)
committerIan Kelling <iank@fsf.org>
Sun, 28 Apr 2024 13:31:36 +0000 (09:31 -0400)
fai-redep
fai/config/scripts/IANK/11-iank

index 8e5919d9561ab05223a6cb18e4a01b9f38fcc8ff..b90b30a285ca5d6654d8191428ec79d97c6f8392 100755 (executable)
--- a/fai-redep
+++ b/fai-redep
@@ -80,6 +80,7 @@ m rsync -rlpt --delete --relative --exclude /fai/config/basefiles/ fai/config "$
 # todo: automatically disable faiserver after a period so
 # these files are not available.
 
+
 if [[ $target ]]; then
   secret_files=(luks/$target luks/host-$target shadow/$target)
   exists=false
@@ -101,7 +102,10 @@ else
   rsync -rlpt /q/root/shadow /q/root/luks "${rpre[@]}"/srv/fai/config/distro-install-common
 fi
 
-rsync -rlpt --delete /a/opt/btrfs-progs-release "${rpre[@]}"/srv/fai/config/distro-install-common
+rsync -rlpt --delete /a/opt/btrfs-progs-release \
+      filesystem/usr/local/bin/ethusb-nm \
+      filesystem/usr/local/bin/ethusb-static \
+      "${rpre[@]}"/srv/fai/config/distro-install-common
 
 dirs=(/p/c/machine_specific/${target:-*}/filesystem/etc/ssh)
 if [[ -e ${dirs[0]} ]]; then
index ce0be4b5321fa9064258184a96c7b2eb3c409e9b..54641b237bcc10b15b30b90bb0f8b662253f8609 100755 (executable)
@@ -184,6 +184,16 @@ EOF
 [main]
 dns=systemd-resolved
 EOF
+
+  $FAI/distro-install-common/ethusb-static
+  if [[ $(dig +short @10.2.0.1 -x 10.2.0.2 2>&1 ||:) == kd.b8.nz. ]] \
+       && ip n show 10.2.0.1 | grep . &>/dev/null; then
+    : # we are at home. note: logic duplicated in btrbk-run
+  else
+    $FAI/distro-install-common/ethusb-nm
+  fi
+
+
 else
   cat > $target/etc/network/interfaces <<-EOF
 # generated by FAI