add os name and version

This commit is contained in:
2020-07-21 20:16:50 -04:00
parent baef789893
commit f91c943bad

View File

@@ -4,13 +4,26 @@ if [ "$EUID" -ne 0 ]; then
echo "Please run as root" echo "Please run as root"
exit exit
fi fi
# ask for the domain, username, and password # ask for the domain, username, and password
read -e -p "Enter Domain name: " -i "home.johnhgaunt.com" domain read -e -p "Enter Domain name: " -i "home.johnhgaunt.com" domain
read -e -p "Enter netBIOS name: " -i "GAUNT" netbiosname read -e -p "Enter netBIOS name: " -i "GAUNT" netbiosname
read -e -p "Enter Domain Admin username: " -i "jgaunt" username read -e -p "Enter Domain Admin username: " -i "jgaunt" username
read -e -s -p "Enter Password: " password read -e -s -p "Enter Password: " password
# get OS ditro and version
OS=$(hostnamectl | awk '/Operating System/ {print $3}')
if [ "${OS}" == "Ubuntu" ]; then
OS_VER=$(hostnamectl | awk '/Operating System/ {print $4}')
else
OS_VER=$(hostnamectl | awk '/Operating System/ {print $5}')
fi
# set os name and version for when the computer joins AD
echo "[active-directory]" > /etc/realmd.conf
echo "os-name = ${OS}" >> /etc/realmd.conf
echo "os-version = ${OS_VER}" >> /etc/realmd.conf
# join the computer to the domain # join the computer to the domain
echo ${password} | realm join -U ${username} ${domain} echo ${password} | realm join -U ${username} ${domain}