Update ADconnection.sh

This commit is contained in:
PierreGoude 2018-03-21 15:05:12 +01:00 committed by GitHub
parent 6e4e2365ae
commit f6767e1df4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -95,7 +95,7 @@ echo "${NUMBER}I searched for an available domain and found nothing, please type
echo "Please enter the domain you wish to join:" echo "Please enter the domain you wish to join:"
read -r DOMAIN read -r DOMAIN
fi fi
discovery=$(realm discover $DOMAIN | grep domain-name) discovery=$($DOMAIN | grep domain-name)
NetBios=$(echo $DOMAIN | cut -d '.' -f1) NetBios=$(echo $DOMAIN | cut -d '.' -f1)
clear clear
sudo echo "${INTRO_TEXT}"Realm= $discovery"${INTRO_TEXT}" sudo echo "${INTRO_TEXT}"Realm= $discovery"${INTRO_TEXT}"
@ -317,7 +317,7 @@ sudo echo "${RED_TEXT}"Installing pakages failed.. please check connection and d
exit exit
fi fi
sleep 1 sleep 1
DOMAIN=$(realm discover | grep -i realm.name | cut -d ':' -f2 | sed -e 's/^[[:space:]]*//') DOMAIN=$( realm discover | grep -i realm-name | awk '{print $2}')
ping -c 1 $DOMAIN ping -c 1 $DOMAIN
if [ $? = 0 ] if [ $? = 0 ]
then then
@ -419,7 +419,7 @@ echo "session required pam_mkhomedir.so skel=/etc/skel/ umask=0022" | sudo tee -
sudo sh -c "echo 'greeter-show-manual-login=true' | sudo tee -a /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf" sudo sh -c "echo 'greeter-show-manual-login=true' | sudo tee -a /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf"
sudo sh -c "echo 'allow-guest=false' | sudo tee -a /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf" sudo sh -c "echo 'allow-guest=false' | sudo tee -a /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf"
therealm=$(realm discover $DOMAIN | grep -i configured: | cut -d ':' -f2 | sed -e 's/^[[:space:]]*//') therealm=$( realm discover | grep -i realm-name | awk '{print $2}')
if [ $therealm = no ] if [ $therealm = no ]
then then
echo Realm configured?.. "${RED_TEXT}"FAIL"${END}" echo Realm configured?.. "${RED_TEXT}"FAIL"${END}"
@ -536,7 +536,7 @@ NetBios=$(echo $DOMAIN | cut -d '.' -f1)
echo "${INTRO_TEXT}"Please type Admin user:"${END}" echo "${INTRO_TEXT}"Please type Admin user:"${END}"
read ADMIN read ADMIN
clear clear
sudo echo "${INTRO_TEXT}"Realm= $discovery"${INTRO_TEXT}" sudo echo "${INTRO_TEXT}"Realm= $DOMAIN"${INTRO_TEXT}"
sudo echo "${NORMAL}${NORMAL}" sudo echo "${NORMAL}${NORMAL}"
sudo realm join --verbose --user=$ADMIN $DOMAIN --install=/ sudo realm join --verbose --user=$ADMIN $DOMAIN --install=/
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
@ -635,7 +635,7 @@ echo "Checking sssd config.. OK"
else else
echo "Checking sssd config.. FAIL" echo "Checking sssd config.. FAIL"
fi fi
therealm=$(realm discover $DOMAIN | grep -i configured: | cut -d ':' -f2 | sed -e 's/^[[:space:]]*//') therealm=$( realm discover | grep -i realm-name | awk '{print $2}')
if [ "$therealm" = no ] if [ "$therealm" = no ]
then then
echo Realm configured?.. "${RED_TEXT}"FAIL"${END}" echo Realm configured?.. "${RED_TEXT}"FAIL"${END}"
@ -690,7 +690,7 @@ CentOS(){
export HOSTNAME export HOSTNAME
myhost=$( hostname ) myhost=$( hostname )
yum -y install realmd sssd oddjob oddjob-mkhomedir adcli samba-common-tools samba-common yum -y install realmd sssd oddjob oddjob-mkhomedir adcli samba-common-tools samba-common
DOMAIN=$(realm discover | grep -i realm.name | cut -d ':' -f2 | sed -e 's/^[[:space:]]*//') DOMAIN=$(realm discover | grep -i realm-name | awk '{print $2}')
ping -c 1 $DOMAIN ping -c 1 $DOMAIN
if [ $? = 0 ] if [ $? = 0 ]
then then
@ -775,7 +775,7 @@ echo "session required pam_mkhomedir.so skel=/etc/skel/ umask=0022" | sudo tee -
sudo sh -c "echo 'greeter-show-manual-login=true' | sudo tee -a /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf" sudo sh -c "echo 'greeter-show-manual-login=true' | sudo tee -a /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf"
sudo sh -c "echo 'allow-guest=false' | sudo tee -a /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf" sudo sh -c "echo 'allow-guest=false' | sudo tee -a /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf"
therealm=$(realm discover $DOMAIN | grep -i configured: | cut -d ':' -f2 | sed -e 's/^[[:space:]]*//') therealm=$( realm discover | grep -i realm-name | awk '{print $2}')
if [ $therealm = no ] if [ $therealm = no ]
then then
echo Realm configured?.. "${RED_TEXT}"FAIL"${END}" echo Realm configured?.. "${RED_TEXT}"FAIL"${END}"
@ -837,7 +837,7 @@ sudo mkdir -p /var/lib/samba/private
sudo aptitude install libsss-sudo sudo aptitude install libsss-sudo
sudo systemctl enable sssd sudo systemctl enable sssd
clear clear
DOMAIN=$(realm discover | grep -i realm.name | cut -d ':' -f2 | sed -e 's/^[[:space:]]*//') DOMAIN=$( realm discover | grep -i realm-name | awk '{print $2}')
echo "" echo ""
echo "please type Domain admin" echo "please type Domain admin"
read -r ADMIN read -r ADMIN
@ -891,7 +891,7 @@ read -r DOMAIN
else else
echo "" echo ""
fi fi
therealm=$(realm discover $DOMAIN | grep -i configured: | cut -d ':' -f2 | sed -e 's/^[[:space:]]*//') therealm=$( realm discover | grep -i realm-name | awk '{print $2}')
if [ $therealm = no ] if [ $therealm = no ]
then then
echo Realm configured?.. "${RED_TEXT}"FAIL"${END}" echo Realm configured?.. "${RED_TEXT}"FAIL"${END}"