improved detecting fails and errors.

This commit is contained in:
Pierre Gode 2019-04-03 09:57:13 +02:00
parent 672bb36ac7
commit c703431673

View File

@ -27,7 +27,7 @@
################################ fix errors # funktion not called ################ ################################ fix errors # funktion not called ################
fixerrors(){ fixerrors(){
#this funktion is not called in the script : to activate, uncomment line line 31 #fixerrors #this funktion is not called in the script : to activate, uncomment line line 31 #fixerrors
#This funktion installs additional pakages due to known issues with Joining and the join hangs after the admin auth #This funktion installs additional packages due to known issues with Joining and the join hangs after the admin auth
sudo add-apt-repository ppa:xtrusia/packagekit-fix sudo add-apt-repository ppa:xtrusia/packagekit-fix
sudo apt-get update sudo apt-get update
sudo apt-get install packagekit sudo apt-get install packagekit
@ -52,7 +52,7 @@ cauth="null"
clear clear
read -r -p "${RED_TEXT}Do you wish to enable SSH login.group.allowed${END}${NUMBER}(y/n)?${END}" yn read -r -p "${RED_TEXT}Do you wish to enable SSH login.group.allowed${END}${NUMBER}(y/n)?${END}" yn
case $yn in case $yn in
[Yy]* ) sudo echo "Cheking if there is any previous configuration" [Yy]* ) sudo echo "Checking if there is any previous configuration"
if [ -f /etc/ssh/login.group.allowed ] < /dev/null > /dev/null 2>&1 if [ -f /etc/ssh/login.group.allowed ] < /dev/null > /dev/null 2>&1
then then
echo "Files seems already to be modified, skipping..." echo "Files seems already to be modified, skipping..."
@ -85,14 +85,14 @@ echo "--------------------------------------------------------------------------
echo "" echo ""
read -r -p "${RED_TEXT}Do you wish to give users on this machine sudo rights?${END}${NUMBER}(y/n)?${END}" yn read -r -p "${RED_TEXT}Do you wish to give users on this machine sudo rights?${END}${NUMBER}(y/n)?${END}" yn
case $yn in case $yn in
[Yy]* ) sudo echo "Cheking if there is any previous configuration" [Yy]* ) sudo echo "Checking if there is any previous configuration"
if [ -f /etc/sudoers.d/sudoers ] < /dev/null > /dev/null 2>&1 if [ -f /etc/sudoers.d/sudoers ] < /dev/null > /dev/null 2>&1
then then
echo "" echo ""
echo "The Sudoers file seems already to be modified, skipping..." echo "The Sudoers file seems already to be modified, skipping..."
echo "" echo ""
else else
read -r -p "${RED_TEXT}Do you wish to DISABLE password promt for users in terminal?${END}${NUMBER}(y/n)?${END}" yn read -r -p "${RED_TEXT}Do you wish to DISABLE password prompt for users in terminal?${END}${NUMBER}(y/n)?${END}" yn
case $yn in case $yn in
[Yy]* ) [Yy]* )
sudo echo "administrator ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/sudoers sudo echo "administrator ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/sudoers
@ -259,7 +259,7 @@ cauth="null"
clear clear
read -r -p 'Do you wish to enable SSH login.group.allowed (y/n)?' yn read -r -p 'Do you wish to enable SSH login.group.allowed (y/n)?' yn
case $yn in case $yn in
[Yy]* ) sudo echo "Cheking if there is any previous configuration" [Yy]* ) sudo echo "Checking if there is any previous configuration"
if [ -f /etc/ssh/login.group.allowed ] < /dev/null > /dev/null 2>&1 if [ -f /etc/ssh/login.group.allowed ] < /dev/null > /dev/null 2>&1
then then
echo "Files seems already to be modified, skipping..." echo "Files seems already to be modified, skipping..."
@ -292,7 +292,7 @@ echo "--------------------------------------------------------------------------
echo "" echo ""
read -r -p 'Do you wish to give users on this machine sudo rights?(y/n)?' yn read -r -p 'Do you wish to give users on this machine sudo rights?(y/n)?' yn
case $yn in case $yn in
[Yy]* ) sudo echo "Cheking if there is any previous configuration" [Yy]* ) sudo echo "Checking if there is any previous configuration"
if [ -f /etc/sudoers.d/sudoers ] < /dev/null > /dev/null 2>&1 if [ -f /etc/sudoers.d/sudoers ] < /dev/null > /dev/null 2>&1
then then
echo "" echo ""
@ -515,7 +515,7 @@ UbuntU(){
export HOSTNAME export HOSTNAME
myhost=$( hostname | cut -d '.' -f1 ) myhost=$( hostname | cut -d '.' -f1 )
clear clear
sudo echo "${RED_TEXT}Installing pakages do no abort!.......${END}" sudo echo "${RED_TEXT}Installing packages do no abort!.......${END}"
if ! sudo apt-get -qq install realmd adcli sssd ntp -y && sudo apt-get -qq install -f -y if ! sudo apt-get -qq install realmd adcli sssd ntp -y && sudo apt-get -qq install -f -y
then then
echo "${RED_TEXT}Failed installing packages, please resolve dpkg and try again ${END}" echo "${RED_TEXT}Failed installing packages, please resolve dpkg and try again ${END}"
@ -525,10 +525,10 @@ clear
if ! sudo dpkg -l | grep realmd if ! sudo dpkg -l | grep realmd
then then
clear clear
sudo echo "${RED_TEXT}Installing pakages failed.. please check connection ,dpkg and apt-get update then try again.${END}" sudo echo "${RED_TEXT}Installing packages failed.. please check connection ,dpkg and apt-get update then try again.${END}"
else else
clear clear
sudo echo "${INTRO_TEXT}Pakages installed${END}" sudo echo "${INTRO_TEXT}packages installed${END}"
fi fi
echo "hostname is $myhost" echo "hostname is $myhost"
echo "Looking for Realms.. please wait" echo "Looking for Realms.. please wait"
@ -620,7 +620,7 @@ ubuntuserver14(){
export HOSTNAME export HOSTNAME
myhost=$( hostname | cut -d '.' -f1 ) myhost=$( hostname | cut -d '.' -f1 )
clear clear
sudo echo "${RED_TEXT}Installing pakages do no abort!.......${END}" sudo echo "${RED_TEXT}Installing packages do no abort!.......${END}"
sudo apt-get -qq install realmd adcli sssd -y sudo apt-get -qq install realmd adcli sssd -y
sudo apt-get -qq install ntp -y sudo apt-get -qq install ntp -y
sudo apt-get -qq install -y sssd-tools samba-common krb5-user sudo apt-get -qq install -y sssd-tools samba-common krb5-user
@ -629,11 +629,11 @@ clear
if ! sudo dpkg -l | grep realmd if ! sudo dpkg -l | grep realmd
then then
clear clear
sudo echo "${RED_TEXT}Installing pakages failed.. please check connection and dpkg and try again.${END}" sudo echo "${RED_TEXT}Installing packages failed.. please check connection and dpkg and try again.${END}"
exit exit
else else
clear clear
sudo echo "${INTRO_TEXT}Pakages installed${END}" sudo echo "${INTRO_TEXT}packages installed${END}"
fi fi
sleep 1 sleep 1
DOMAIN=$( realm discover | grep -i realm-name | awk '{print $2}') DOMAIN=$( realm discover | grep -i realm-name | awk '{print $2}')
@ -679,7 +679,7 @@ cauth="null"
clear clear
read -r -p "${RED_TEXT}Do you wish to enable SSH login.group.allowed${END}${NUMBER}(y/n)?${END}" yn read -r -p "${RED_TEXT}Do you wish to enable SSH login.group.allowed${END}${NUMBER}(y/n)?${END}" yn
case $yn in case $yn in
[Yy]* ) sudo echo "Cheking if there is any previous configuration" [Yy]* ) sudo echo "Checking if there is any previous configuration"
if [ -f /etc/ssh/login.group.allowed ] < /dev/null > /dev/null 2>&1 if [ -f /etc/ssh/login.group.allowed ] < /dev/null > /dev/null 2>&1
then then
echo "Files seems already to be modified, skipping..." echo "Files seems already to be modified, skipping..."
@ -713,7 +713,7 @@ echo "--------------------------------------------------------------------------
echo "" echo ""
read -r -p "${RED_TEXT}Do you wish to give users on this machine sudo rights?${END}${NUMBER}(y/n)?${END}" yn read -r -p "${RED_TEXT}Do you wish to give users on this machine sudo rights?${END}${NUMBER}(y/n)?${END}" yn
case $yn in case $yn in
[Yy]* ) sudo echo "Cheking if there is any previous configuration" [Yy]* ) sudo echo "Checking if there is any previous configuration"
if [ -f /etc/sudoers.d/sudoers ] < /dev/null > /dev/null 2>&1 if [ -f /etc/sudoers.d/sudoers ] < /dev/null > /dev/null 2>&1
then then
echo "" echo ""
@ -799,7 +799,7 @@ myhost=$( hostname | cut -d '.' -f1 )
export whoami export whoami
whoamis=$( whoami ) whoamis=$( whoami )
admins=$( grep home /etc/passwd | grep bash | cut -d ':' -f1 ) admins=$( grep home /etc/passwd | grep bash | cut -d ':' -f1 )
sudo echo "${RED_TEXT}Installing pakages do no abort!.......${END}" sudo echo "${RED_TEXT}Installing packages do no abort!.......${END}"
sudo apt-get -qq update sudo apt-get -qq update
sudo apt-get -qq install libsss-sudo -y sudo apt-get -qq install libsss-sudo -y
sudo apt-get -qq install adcli -y sudo apt-get -qq install adcli -y
@ -814,11 +814,11 @@ clear
if ! sudo dpkg -l | grep realmd if ! sudo dpkg -l | grep realmd
then then
clear clear
sudo echo "${RED_TEXT}Installing pakages failed.. please check connection ,dpkg and apt-get update then try again.${END}" sudo echo "${RED_TEXT}Installing packages failed.. please check connection ,dpkg and apt-get update then try again.${END}"
exit exit
else else
clear clear
sudo echo "${INTRO_TEXT}Pakages installed${END}" sudo echo "${INTRO_TEXT}packages installed${END}"
fi fi
echo "hostname is $myhost" echo "hostname is $myhost"
DOMAIN=$(realm discover | grep -i realm.name | awk '{print $2}') DOMAIN=$(realm discover | grep -i realm.name | awk '{print $2}')
@ -871,7 +871,7 @@ admins=$( grep home /etc/passwd | grep bash | cut -d ':' -f1 )
echo "$admins ALL=(ALL:ALL) ALL | tee -a /etc/sudoers.d/admin" echo "$admins ALL=(ALL:ALL) ALL | tee -a /etc/sudoers.d/admin"
fi fi
clear clear
sudo echo "${RED_TEXT}Installing pakages do no abort!.......${END}" sudo echo "${RED_TEXT}Installing packages do no abort!.......${END}"
sudo apt-get -qq update sudo apt-get -qq update
sudo apt-get -qq install libsss-sudo -y sudo apt-get -qq install libsss-sudo -y
sudo apt-get -qq install realmd adcli sssd -y sudo apt-get -qq install realmd adcli sssd -y
@ -885,11 +885,11 @@ clear
if ! sudo dpkg -l | grep realmd if ! sudo dpkg -l | grep realmd
then then
clear clear
sudo echo "${RED_TEXT}Installing pakages failed.. please check connection ,dpkg and apt-get update then try again.${END}" sudo echo "${RED_TEXT}Installing packages failed.. please check connection ,dpkg and apt-get update then try again.${END}"
exit exit
else else
clear clear
sudo echo "${INTRO_TEXT}Pakages installed${END}" sudo echo "${INTRO_TEXT}packages installed${END}"
fi fi
echo "hostname is $myhost" echo "hostname is $myhost"
sleep 1 sleep 1
@ -1103,7 +1103,7 @@ fi
allowguest=$( sudo grep manual /usr/share/lightdm/lightdm.conf.d/50-disable-guest.conf | grep true | cut -d '=' -f2 | head -1 ) allowguest=$( sudo grep manual /usr/share/lightdm/lightdm.conf.d/50-disable-guest.conf | grep true | cut -d '=' -f2 | head -1 )
if [ "$allowguest" = "true" ] if [ "$allowguest" = "true" ]
then then
echo "Lightdm is already confugured.. skipping.." echo "Lightdm is already configured.. skipping.."
else else
sudo echo "greeter-show-manual-login=true" | sudo tee -a /usr/share/lightdm/lightdm.conf.d/50-disable-guest.conf sudo echo "greeter-show-manual-login=true" | sudo tee -a /usr/share/lightdm/lightdm.conf.d/50-disable-guest.conf
fi fi
@ -1115,18 +1115,18 @@ exit
Realmdupdate(){ Realmdupdate(){
clear clear
echo "" echo ""
echo "this secion has been depricated, If you are still using likewise please see code" echo "this section has been deprecated, If you are still using likewise please see code"
echo "" echo ""
exit exit
} }
#this section has been depricated #this section has been deprecated
#If you are still using likewise please uncomment lines below and line 33 #If you are still using likewise please uncomment lines below and line 33
#Realmdupdate11(){ #Realmdupdate11(){
#export HOSTNAME #export HOSTNAME
#myhost=$( hostname | cut -d '.' -f1 ) #myhost=$( hostname | cut -d '.' -f1 )
#echo "This will delete your homefolder and replace it. Please do a BACKUP" #echo "This will delete your homefolder and replace it. Please do a BACKUP"
#echo "Press ctrl C to cancel skript if you wish to make an backup first" #echo "Press ctrl C to cancel script if you wish to make an backup first"
#sleep 5 #sleep 5
#sudo apt-get update #sudo apt-get update
#clear #clear
@ -1668,13 +1668,13 @@ echo ""
fi fi
fi fi
else else
echo "this seems to be a server, swithching to server mode" echo "this seems to be a server, Switching to server mode"
ubuntuserver14 ubuntuserver14
fi fi
export HOSTNAME export HOSTNAME
myhost=$( hostname | cut -d '.' -f1 ) myhost=$( hostname | cut -d '.' -f1 )
clear clear
sudo echo "${RED_TEXT}Installing pakages do no abort!.......${END}" sudo echo "${RED_TEXT}Installing packages do no abort!.......${END}"
sudo apt-get -qq install realmd adcli sssd -y sudo apt-get -qq install realmd adcli sssd -y
sudo apt-get -qq install ntp -y sudo apt-get -qq install ntp -y
sudo apt-get install -f -y sudo apt-get install -f -y
@ -1682,11 +1682,11 @@ clear
if ! sudo dpkg -l | grep realmd if ! sudo dpkg -l | grep realmd
then then
clear clear
sudo echo "${RED_TEXT}Installing pakages failed.. please check connection ,dpkg and apt-get update then try again.${END}" sudo echo "${RED_TEXT}Installing packages failed.. please check connection ,dpkg and apt-get update then try again.${END}"
exit exit
else else
clear clear
sudo echo "${INTRO_TEXT}Pakages installed${END}" sudo echo "${INTRO_TEXT}packages installed${END}"
fi fi
echo "hostname is $myhost" echo "hostname is $myhost"
echo "Looking for Realms.. please wait" echo "Looking for Realms.. please wait"