Update ADconnection.sh

This commit is contained in:
PierreGoude 2017-02-08 11:42:35 +01:00 committed by GitHub
parent 74844a2db4
commit be8c637102

View File

@ -4,10 +4,10 @@
# This script is written by Pierre Goude # # This script is written by Pierre Goude #
# This program is open source; you can redistribute it and/or modify it under the terms of the GNU General Public # # This program is open source; you can redistribute it and/or modify it under the terms of the GNU General Public #
# This is an normal bash script and can be executed with sh # # This is an normal bash script and can be executed with sh #
# # # Generic user setup is: administrator, domain admins, groupnamesudores= groupname=hostname + sudoers on groupname #
##################################################################################################################### #####################################################################################################################
#known bugs: see line 462-463 #known bugs: see line 23-24
# ~~~~~~~~~~ Environment Setup ~~~~~~~~~~ # # ~~~~~~~~~~ Environment Setup ~~~~~~~~~~ #
NORMAL=`echo "\033[m"` NORMAL=`echo "\033[m"`
@ -18,6 +18,16 @@
END=`echo "\033[0m"` END=`echo "\033[0m"`
# ~~~~~~~~~~ Environment Setup ~~~~~~~~~~ # # ~~~~~~~~~~ Environment Setup ~~~~~~~~~~ #
################################ fix errors # funktion not called ################
fixerrors(){
#this funktion is not called in the script : to activate, uncomment line line 508 #fixerrors
#This funktion installs additional pakages due to known issues with Joining and the join hangs after the admin login
sudo add-apt-repository ppa:xtrusia/packagekit-fix
sudo apt-get update
sudo apt-get install packagekit
}
####################### Setup for Ubuntu16 and Ubuntu 14 clients ####################################### ####################### Setup for Ubuntu16 and Ubuntu 14 clients #######################################
ubuntuclient(){ ubuntuclient(){
desktop=$(sudo apt list --installed | grep -i desktop | grep -i ubuntu | cut -d '-' -f1 | grep -i desktop) desktop=$(sudo apt list --installed | grep -i desktop | grep -i ubuntu | cut -d '-' -f1 | grep -i desktop)
@ -43,7 +53,7 @@ read -p "Do you wish to use it (y/n)?" yn
[Yy]* ) echo "${INTRO_TEXT}"Please log in with domain admin to $DOMAIN to connect"${END}";; [Yy]* ) echo "${INTRO_TEXT}"Please log in with domain admin to $DOMAIN to connect"${END}";;
[Nn]* ) echo "Please enter the domain you wish to join:" [Nn]* ) echo "Please enter the domain you wish to join:"
read DOMAIN;; read -r DOMAIN;;
* ) echo 'Please answer yes or no.';; * ) echo 'Please answer yes or no.';;
esac esac
echo "${INTRO_TEXT}"Please type Admin user"${END}" echo "${INTRO_TEXT}"Please type Admin user"${END}"
@ -146,10 +156,10 @@ sudo apt-get install ntp -y
sudo apt-get install realmd sssd sssd-tools samba-common krb5-user sudo apt-get install realmd sssd sssd-tools samba-common krb5-user
clear clear
echo "Please enter the domain you wish to join: " echo "Please enter the domain you wish to join: "
read DOMAIN read -r DOMAIN
NetBios=$(echo $DOMAIN | cut -d '.' -f1) NetBios=$(echo $DOMAIN | cut -d '.' -f1)
echo "Please enter a domain admin login to use: " echo "Please enter a domain admin login to use: "
read ADMIN read -r ADMIN
discovery=$(realm discover $DOMAIN | grep domain-name) discovery=$(realm discover $DOMAIN | grep domain-name)
clear clear
sudo echo "${INTRO_TEXT}"Realm= $discovery"${INTRO_TEXT}" sudo echo "${INTRO_TEXT}"Realm= $discovery"${INTRO_TEXT}"
@ -249,7 +259,7 @@ read -p "Do you wish to use it (y/n)?" yn
esac esac
NetBios=$(echo $DOMAIN | cut -d '.' -f1) NetBios=$(echo $DOMAIN | cut -d '.' -f1)
echo "Please enter a domain admin login to use: " echo "Please enter a domain admin login to use: "
read ADMIN read -r ADMIN
discovery=$(realm discover $DOMAIN | grep domain-name) discovery=$(realm discover $DOMAIN | grep domain-name)
clear clear
sudo echo "${INTRO_TEXT}"Realm= $discovery"${INTRO_TEXT}" sudo echo "${INTRO_TEXT}"Realm= $discovery"${INTRO_TEXT}"
@ -404,7 +414,7 @@ find=$( realm discover )
if [ $? = 1 ] if [ $? = 1 ]
then then
echo "Sorry I am having issues finding your domain.. please type it" echo "Sorry I am having issues finding your domain.. please type it"
read DOMAIN read -r DOMAIN
else else
echo "" echo ""
fi fi
@ -457,22 +467,13 @@ fi
exit exit
} }
################################ fix errors # funktion not called ################
fixerrors(){
#this funktion is not called in the script : to activate uncommen line line 508 #fixerrors
#This funktion install additional pakages due to known issues with Joining and the join hangs after the admin login
sudo add-apt-repository ppa:xtrusia/packagekit-fix
sudo apt-get update
sudo apt-get install packagekit
}
############################### Reauth ########################################## ############################### Reauth ##########################################
Reauthenticate14(){ Reauthenticate14(){
echo "Reauth for Realmd ubuntu 14 only!" echo "Reauth for Realmd ubuntu 14 only!"
echo "Type domain" echo "Type domain"
read DOMAIN read -r DOMAIN
echo "Type Adminuser" echo "Type Adminuser"
read ADMIN read -r ADMIN
discover=$(realm discover | grep domain-name: | cut -d ':' -f2) discover=$(realm discover | grep domain-name: | cut -d ':' -f2)
realm leave $discover realm leave $discover
sudo realm join -v -U $ADMIN $DOMAIN --install=/ sudo realm join -v -U $ADMIN $DOMAIN --install=/