From 9012d1fdae683da02f5fbd4d556acf565ef7ed73 Mon Sep 17 00:00:00 2001 From: PierreGode <8579922+PierreGode@users.noreply.github.com> Date: Fri, 22 Oct 2021 10:15:20 +0200 Subject: [PATCH] Added Support for Suse Added Support for Suse --- ADconnection.sh | 78 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/ADconnection.sh b/ADconnection.sh index 59095da..bfd137f 100755 --- a/ADconnection.sh +++ b/ADconnection.sh @@ -758,6 +758,7 @@ MintOS=$( hostnamectl | grep -i Operating | awk '{print $4}' ) < /dev/null > /de rasp=$( lsb_release -a | grep -i Distributor | awk '{print $3}' ) < /dev/null > /dev/null 2>&1 kalilinux=$( lsb_release -a | grep -i Distributor | awk '{print $3}' ) < /dev/null > /dev/null 2>&1 elementary=$( hostnamectl | grep -i Operating | awk '{print $3}' ) < /dev/null > /dev/null 2>&1 +SUSE=$( hostnamectl | grep -i Operating | awk '{print $3}' ) < /dev/null > /dev/null 2>&1 clear #### OS detection #### if [ "$TheOS" = "Zorin" ] < /dev/null > /dev/null 2>&1 @@ -779,6 +780,11 @@ then echo "Debian detected" debianclient else +if [ "$TheOS" = "SUSE" ] < /dev/null > /dev/null 2>&1 +then +echo "SUSE detected" +SUSEclient +else if [ "$TheOS" = "Ubuntu" ] < /dev/null > /dev/null 2>&1 then echo "Ubuntu detected" @@ -826,6 +832,7 @@ fi fi fi fi +fi } ################################ Ubuntu 14-20 ########################################### @@ -1655,6 +1662,77 @@ fi fi_auth } +####################################### SUSE ########################################## +SUSEclient(){ +export HOSTNAME +myhost=$( hostname | cut -d '.' -f1 ) +clear +sudo echo "${RED_TEXT}Installing packages do no abort!.......${END}" +sudo zypper -n install adcli +sudo zypper -nupdate +sudo zypper -n install libsss-sudo +sudo zypper -n install realmd adcli sssd curl +sudo zypper -n install ntp +sudo zypper -n install realmd adcli sssd +sudo zypper -n install ntp +clear +echo "hostname is $myhost" +sleep 1 +REALM=$( sudo grep DOMAIN readfile | awk '{print $3}' ) +if [ "$REALM" = "null" ] +then +DOMAIN=$(realm discover | grep -i realm.name | awk '{print $2}') +if ! ping -c 2 "$DOMAIN" < /dev/null > /dev/null 2>&1 +then +clear +echo "${NUMBER}I searched for an available domain and found nothing, please type your domain manually below... ${END}" +echo "Please enter the domain you wish to join:" +read -r DOMAIN +else +clear +echo "${NUMBER}I searched for an available domain and found ${MENU}>>> $DOMAIN <<<${END}${END}" +read -r -p "Do you wish to use it (y/n)?" yn + case $yn in + [Yy]* ) echo "";; + + [Nn]* ) echo "Please enter the domain you wish to join:" + read -r DOMAIN;; + * ) echo 'Please answer yes or no.';; + esac +fi +else +DOMAIN=$( realm discover | grep -i realm.name | awk '{print $2}' ) +echo "Using Domain: $DOMAIN" +#DOMAIN=$(echo "$REALM") +fi +NetBios=$(echo "$DOMAIN" | cut -d '.' -f1) +echo "" +if [ -f readfile ] +then +admin=$( sudo grep ADADMIN readfile | awk '{print $3}' ) +if [ "$admin" = "null" ] +then +echo "${INTRO_TEXT}Please log in with domain admin to $DOMAIN to connect${END}" +echo "${INTRO_TEXT}Please type Admin user:${END}" +read -r ADMIN +else +ADMIN=$( echo $admin ) +fi +else +echo "${INTRO_TEXT}Please type Admin user:${END}" +read -r ADMIN +fi +clear +sudo echo "${INTRO_TEXT}Realm= $DOMAIN${END}" +sudo echo "${NORMAL}${NORMAL}" +if ! sudo realm join --verbose --user="$ADMIN" "$DOMAIN" --install=/ +then +echo "${RED_TEXT}AD join failed.please check your errors with journalctl -xe${END}" +exit +fi +fi_auth +} + ####################################### Debian ########################################## debianclient(){ export HOSTNAME