From 6c3662a2e213c79183f7d4b0d99a9e2395aeb085 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Fri, 18 Feb 2022 11:40:19 -0500 Subject: [PATCH] This should work --- template_setup.sh | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/template_setup.sh b/template_setup.sh index 031f8f8..518876c 100644 --- a/template_setup.sh +++ b/template_setup.sh @@ -3,20 +3,14 @@ echo "Setting up template environment" echo "Running topgrade" /opt/topgrade/topgrade -nssdb_dir="/etc/ipa/nssdb" echo "Checking if Directory $nssdb_dir contains Membership to FreeIPA Realm" realm_join=0 -if [ -d "$nssdb_dir" ] +if [[ -f /var/lib/ipa-client/sysrestore/sysrestore.state ]] then - if [ "$(ls -A $nssdb_dir)" ]; then - echo "Directory $nssdb_dir is not Empty." - realm_join=1 - echo "ipa-client appears to already be joined to FreeIPA Server Realm" - else - echo "$nssdb_dir is Empty" - fi + echo "$HOSTNAME appears to not be joined to FreeIPA Server Realm" + realm_join=1 else - echo "Directory $nssdb_dir not found." + echo "$HOSTNAME appears to already be joined to FreeIPA Server Realm" fi if [[ $HOSTNAME == *template* ]]; then