Shell-Scripts/Onboarding/xe-utils-install.sh

45 lines
991 B
Bash

#!/bin/bash
# Check if root
if [ $(whoami) != 'root' ]; then
echo "Please run as root."
exit 1
else
echo "root check complete."
fi
cd /tmp
#Check OS Version
case $(cat /etc/os-release | grep ^ID= | sed -e "s/^ID=//") in
"debian")
wget http://config.lan.fisherhome.xyz/xe-utils/xe-guest-utilities_8.4.0-1_amd64.deb
dpkg -i *.deb
success=true
;;
"ubuntu")
wget http://config.lan.fisherhome.xyz/xe-utils/xe-guest-utilities_8.4.0-1_amd64.deb
dpkg -i *.deb
success=true
;;
'"almalinux"')
wget http://config.lan.fisherhome.xyz/xe-utils/xe-guest-utilities-8.4.0-1.x86_64.rpm
wget http://config.lan.fisherhome.xyz/xe-utils/xe-guest-utilities-xenstore-8.4.0-1.x86_64.rpm
dnf install -y *.rpm
success=true
;;
*)
echo "Uknown OS Type. Exiting"
success=false
;;
esac
if [ $success = true ]; then
echo "Installation complete rebooting in 3 seconds."
sleep 1
echo "2.."
sleep 1
echo "1..."
sleep 1
reboot now
fi