commit:     82c8ee5c185c520d80fda3319b260852ebc1ceb2
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 13 20:16:54 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Oct 13 20:30:55 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=82c8ee5c

Enable all ethernet network adaptors with dhcp by default

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 targets/support/diskimagefs-update.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/targets/support/diskimagefs-update.sh 
b/targets/support/diskimagefs-update.sh
index 45d870a5..5204a31f 100755
--- a/targets/support/diskimagefs-update.sh
+++ b/targets/support/diskimagefs-update.sh
@@ -16,6 +16,17 @@ if [[ $(readlink /etc/portage/make.profile) == *systemd* ]] 
; then
 # generic    - an image with no means of logging in... needs postprocessing
 #              no services are started
 
+configure_dhcp() {
+       echo "Configuring DHCP on all ethernet devices"
+       cat > /etc/systemd/network/default.network <<'END'
+[Match]
+Name=en*
+
+[Network]
+DHCP=yes
+END
+}
+
 echo "Generating /etc/locale.gen"
 cat > /etc/locale.gen <<END
 en_US ISO-8859-1
@@ -45,6 +56,7 @@ case ${clst_diskimage_type} in
                passwd -d root || die "Failed removing root password"
                echo "Running systemd-firstboot"
                systemd-firstboot --timezone=UTC || die "Failed running 
systemd-firstboot"
+               configure_dhcp
                ;;
        *)
                die "As yet unsupported image type"

Reply via email to