From 172bb1288504a243f75bff1b2fe339d439b35876 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 23 Jun 2021 12:07:13 -0400 Subject: [PATCH] Modify Suse diskless for suse networking Suse doesn't use network manager, populate sysconfig instead. --- .../hooks/cmdline/10-confluentdiskless.sh | 58 ++----------------- .../profiles/default/scripts/imageboot.sh | 21 +++++++ 2 files changed, 26 insertions(+), 53 deletions(-) diff --git a/confluent_osdeploy/suse15-diskless/initramfs/lib/dracut/hooks/cmdline/10-confluentdiskless.sh b/confluent_osdeploy/suse15-diskless/initramfs/lib/dracut/hooks/cmdline/10-confluentdiskless.sh index 722b6961..85549139 100644 --- a/confluent_osdeploy/suse15-diskless/initramfs/lib/dracut/hooks/cmdline/10-confluentdiskless.sh +++ b/confluent_osdeploy/suse15-diskless/initramfs/lib/dracut/hooks/cmdline/10-confluentdiskless.sh @@ -110,62 +110,14 @@ else if [ ! -z "$v4gw" ]; then ip route add default via $v4gw fi - mkdir -p /run/NetworkManager/system-connections - cat > /run/NetworkManager/system-connections/$ifname.nmconnection << EOC -[connection] -id=eno1 -EOC - echo uuid=$(uuidgen) >> /run/NetworkManager/system-connections/$ifname.nmconnection - cat >> /run/NetworkManager/system-connections/$ifname.nmconnection << EOC -type=ethernet -autoconnect-retries=1 -EOC - echo interface-name=$ifname >> /run/NetworkManager/system-connections/$ifname.nmconnection - cat >> /run/NetworkManager/system-connections/$ifname.nmconnection << EOC -multi-connect=1 -permissions= -wait-device-timeout=60000 - -[ethernet] -mac-address-blacklist= - -[ipv4] -EOC - echo address1=$v4addr/$v4nm >> /run/NetworkManager/system-connections/$ifname.nmconnection + mkdir -p /run/confluent + echo -e "BOOTPROTO='static'\nSTARTMODE='auto'" >> /run/confluent/ifcfg-$ifname + echo "IPADDR='$v4addr/$v4nm'" >> /run/confluent/ifcfg-$ifname if [ ! -z "$v4gw" ]; then - echo gateway=$v4gw >> /run/NetworkManager/system-connections/$ifname.nmconnection + echo defafult $v4gw - $ifname > /run/confluent/ifroute-$ifname fi - nameserversec=0 - nameservers="" - while read -r entry; do - if [ $nameserversec = 1 ]; then - if [[ $entry == "-"* ]]; then - nameservers="$nameservers"${entry#- }";" - continue - fi - fi - nameserversec=0 - if [ "${entry%:*}" = "nameservers" ]; then - nameserversec=1 - continue - fi - done < /etc/confluent/confluent.deploycfg - echo dns=$nameservers >> /run/NetworkManager/system-connections/$ifname.nmconnection - dnsdomain=$(grep ^dnsdomain: /etc/confluent/confluent.deploycfg) - dnsdomain=${dnsdomain#dnsdomain: } - echo dns-search=$dnsdomain >> /run/NetworkManager/system-connections/$ifname.nmconnection - cat >> /run/NetworkManager/system-connections/$ifname.nmconnection << EOC -may-fail=false -method=manual - -[ipv6] -addr-gen-mode=eui64 -method=auto - -[proxy] -EOC fi -chmod 600 /run/NetworkManager/system-connections/*.nmconnection + echo -n "Initializing ssh..." ssh-keygen -A for pubkey in /etc/ssh/ssh_host*key.pub; do diff --git a/confluent_osdeploy/suse15-diskless/profiles/default/scripts/imageboot.sh b/confluent_osdeploy/suse15-diskless/profiles/default/scripts/imageboot.sh index fe224247..f6304089 100644 --- a/confluent_osdeploy/suse15-diskless/profiles/default/scripts/imageboot.sh +++ b/confluent_osdeploy/suse15-diskless/profiles/default/scripts/imageboot.sh @@ -79,4 +79,25 @@ curl -sf https://$confluent_mgr/confluent-public/os/$confluent_profile/scripts/o chmod +x /sysroot/opt/confluent/bin/onboot.sh ln -s /etc/systemd/system/onboot.service /sysroot/etc/systemd/system/multi-user.target.wants/onboot.service cp /etc/confluent/functions /sysroot/etc/confluent/functions + +nameserversec=0 +nameservers="" +while read -r entry; do + if [ $nameserversec = 1 ]; then + if [[ $entry == "-"* ]]; then + nameservers="$nameservers"${entry#- }";" + continue + fi + fi + nameserversec=0 + if [ "${entry%:*}" = "nameservers" ]; then + nameserversec=1 + continue + fi +done < /etc/confluent/confluent.deploycfg +sed -i 's/^NETCONFIG_DNS_STATIC_SERVERS="/NETCONFIG_DNS_STATIC_SERVERS="'$nameservers/ +dnsdomain=$(grep ^dnsdomain: /etc/confluent/confluent.deploycfg) +dnsdomain=${dnsdomain#dnsdomain: } +sed -i 's/^NETCONFIG_DNS_STATIC_SEARCHLIST="/NETCONFIG_DNS_STATIC_SEARCHLIST="'$dnsdomain/ +cp /run/confluent/ifroute-* /run/confluent/ifcfg-* /sysroot/etc/sysconfig/network exec /opt/confluent/bin/start_root