From 37a376466c6fdc42bd7b8b86241d1fc1ce15389b Mon Sep 17 00:00:00 2001
From: Sam Chudnick <sam@chudnick.com>
Date: Sat, 21 May 2022 14:33:52 -0400
Subject: Don't change DNS servers by default. Fixed issue with NFS setup.

---
 ipaconf | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/ipaconf b/ipaconf
index 7d653d2..aeab5c8 100755
--- a/ipaconf
+++ b/ipaconf
@@ -1,7 +1,7 @@
 #!/bin/sh
 #
 # configures a FreeIPA client system by:
-# enrolling in a FreeIPA domain (includes ldap,kerberos,ntp
+# enrolling in a FreeIPA domain (includes ldap,kerberos,ntp)
 # setting up FreeIPA server as an nss target
 # configuring as a kerberized NFSv4 client or server
 # configuring for FreeIPA-managed automount
@@ -44,12 +44,12 @@ done
 grep -q bullseye-backports /etc/apt/sources.list || echo "deb https://deb.debian.org/debian bullseye-backports main" >> /etc/apt/sources.list
 
 # Install required packages
-apt update
+ping -q -c 1 9.9.9.9 2>/dev/null && apt update
 apt install freeipa-client nfs-common autofs autofs-ldap -y
 [ $nfssrv -eq 1 ] && apt install nfs-kernel-server -y
 
 # Change DNS
-echo "domain $ipadomain\nsearch $ipadomain\nnameserver $dnssrv" > /etc/resolv.conf
+#echo "domain $ipadomain\nsearch $ipadomain\nnameserver $dnssrv" > /etc/resolv.conf
 
 # Move chrony conf so IPA installer can configure its own
 mv /etc/chrony/chrony.conf /etc/chrony/chrony.conf.ipabk
@@ -95,10 +95,9 @@ chmod 600 /etc/autofs_ldap_auth.conf
 systemctl restart autofs
 
 # Configure NFS
-sed -i "s/NEED_IDMAPD.*$/NEED_IDMAPD=yes"
-sed -i "s/NEED_GSSD.*$/NEED_GSSD=yes"
-[ $nfssrv -eq 1 ] && sed -i "s/NEED_SVCGSSD.*$/NEEDSVCGSSD=\"yes\"/" /etc/default/nfs-kernel-server
-systemctl restart nfs-kernel-server
+sed -i "s/NEED_IDMAPD.*$/NEED_IDMAPD=yes/" /etc/default/nfs-common
+sed -i "s/NEED_GSSD.*$/NEED_GSSD=yes/" /etc/default/nfs-common
+[ $nfssrv -eq 1 ] && sed -i "s/NEED_SVCGSSD.*$/NEEDSVCGSSD=\"yes\"/" /etc/default/nfs-kernel-server && systemctl restart nfs-kernel-server
 
 # Manaul steps for NFS server
 ipasrv=$(grep "server =" /etc/ipa/default.conf | cut -d '=' -f 2 | tr -d ' ')
-- 
cgit v1.2.3