mirror of
https://github.com/That-Guy-Jack/HP-ILO-Fan-Control.git
synced 2025-04-26 12:32:28 +00:00
Rewrite Install.sh
This commit is contained in:
parent
4e2e70671c
commit
2e8eacfe4a
139
Install.sh
139
Install.sh
@ -1,76 +1,65 @@
|
|||||||
GNU nano 4.8 Install.sh Modified
|
#!/bin/bash
|
||||||
##!/bin/bash
|
|
||||||
echo "You are about to download and install the required items for HP ILO4 fan control."
|
if [ $(id -u) -ne 0 ]; then
|
||||||
echo "Do you accept? [yes] or [no] :"
|
echo -e "\e[31mThis must be run as root!\e[0m"
|
||||||
read input
|
exit 126
|
||||||
if [ $input = yes ] ; then
|
fi
|
||||||
# agreement confirmed
|
|
||||||
# refresh OR create agreement file status
|
echo "You are about to download and install the required items for HP ILO4 fan control."
|
||||||
echo "Installing required apt packages; sshpass, lm-sensors, and wget"
|
read -rep "Do you accept? (y/N): " ACCEPTED
|
||||||
apt install sshpass wget lm-sensors jq -y
|
if [[ ${ACCEPTED,,} =~ ^[y] ]]; then
|
||||||
echo "Installed required apt packages"
|
mkdir -p ~/autofan
|
||||||
cd /
|
cd ~/autofan
|
||||||
echo "Downloading ILO_250 for ROM upgrade to the / directory."
|
echo "Installing required packages..."
|
||||||
wget https://github.com/That-Guy-Jack/HP-ILO-Fan-Control/tree/main/Files/ilo_250
|
apt install sshpass wget lm-sensors jq -y
|
||||||
echo "Download finished!"
|
echo -e "\e[92mDownloading ILO_250 for ROM upgrade\e[0m"
|
||||||
echo "Making autofan.service"
|
wget -q https://github.com/That-Guy-Jack/HP-ILO-Fan-Control/tree/main/Files/ilo_250
|
||||||
cd /etc/systemd/system/
|
echo -e "\e[92m Creating autofan service\e[0m"
|
||||||
wget https://raw.githubusercontent.com/That-Guy-Jack/HP-ILO-Fan-Control/main/Files/autofan.service
|
wget -q https://raw.githubusercontent.com/That-Guy-Jack/HP-ILO-Fan-Control/main/Files/autofan.service
|
||||||
echo "Finished making autofan.service"
|
mv autofan.service /etc/systemd/system/
|
||||||
echo "Is Your host based on EXSI? (uses ILO temps over lm-sensors) [Y]/[N]"
|
echo -e "\e[92m autofan service created\e[0m"
|
||||||
read exsi
|
read -rep $'Which server are you running? (Enter 1-4)
|
||||||
if [ $exsi = Y ]
|
1. DL360p G8 (No ESXi)
|
||||||
echo "Which server are you running? DL360p G8 (1) or DL380p G8 (2) [1] or [2] :"
|
2. DL380p G8 (no ESXi)
|
||||||
read server
|
3. DL360p G8 (ESXi-based)
|
||||||
if [ $server = 1 ] ; then
|
4. DL380p G8 (ESXi-based)\n' HOSTCHOICE
|
||||||
echo "Preping autofan.sh for DL360p G8"
|
case $HOSTCHOICE in
|
||||||
cd /
|
1)
|
||||||
echo "Downloading latest autofan.sh"
|
AUTOFANFILE="autofan.sh"
|
||||||
wget https://raw.githubusercontent.com/That-Guy-Jack/HP-ILO-Fan-Control/main/Files/autofan-dl360p-g8-EXSI.sh
|
HOSTTYPE="DL360p G8 (No ESXi)"
|
||||||
echo "Downloaded autofan.sh, please change the placeholders with correct info"
|
;;
|
||||||
echo "Please cisit the GitHub page to follow the instructions!"
|
2)
|
||||||
echo "https://github.com/That-Guy-Jack/HP-ILO-Fan-Control"
|
AUTOFANFILE="autofan-dl380p-g8.sh"
|
||||||
exit 1
|
HOSTTYPE="DL380p G8 (No ESXi)"
|
||||||
elif [ $server = 2 ] ; then
|
;;
|
||||||
echo "Preping autofan.sh for DL380p G8"
|
3)
|
||||||
cd /
|
AUTOFANFILE="autofan-dl360p-g8-EXSI.sh"
|
||||||
echo "Downloading latest autofan.sh for DL380p G8"
|
HOSTTYPE="DL360p G8 (ESXi-based)"
|
||||||
wget https://raw.githubusercontent.com/That-Guy-Jack/HP-ILO-Fan-Control/main/Files/autofan-dl380p-g8-EXSI.sh
|
;;
|
||||||
echo "Renaming file"
|
4)
|
||||||
mv autofan-dl380p-g8.sh autofan.sh
|
AUTOFANFILE="autofan-dl380p-g8-EXSI.sh"
|
||||||
echo "Downloaded autofan.sh, please change the placeholders with correct info"
|
HOSTTYPE="DL370p G8 (ESXi-based)"
|
||||||
echo "Please cisit the GitHub page to follow the instructions!"
|
;;
|
||||||
echo "https://github.com/That-Guy-Jack/HP-ILO-Fan-Control"
|
*)
|
||||||
exit 1
|
echo -e "\e[31mInvalid choice. Exiting.\e[0m"
|
||||||
fi
|
exit 1
|
||||||
else
|
;;
|
||||||
echo " :( exitting"
|
esac
|
||||||
exit 1
|
|
||||||
else
|
echo "Preping autofan.sh for $HOSTTYPE"
|
||||||
echo "Which server are you running? DL360p G8 (1) or DL380p G8 (2) [1] or [2] :"
|
echo "Downloading latest autofan.sh"
|
||||||
read server
|
wget -q https://raw.githubusercontent.com/That-Guy-Jack/HP-ILO-Fan-Control/main/Files/$AUTOFANFILE -O autofan.sh
|
||||||
if [ $server = 1 ] ; then
|
read -rep 'Enter iLO Username: ' ILOUSERNAME
|
||||||
echo "Preping autofan.sh for DL360p G8"
|
read -rep 'Enter iLO Password: ' ILOPASSWORD
|
||||||
cd /
|
read -rep 'Enter iLO IP/hostname: ' ILOHOST
|
||||||
echo "Downloading latest autofan.sh"
|
sed -ri "s/your username/$ILOUSERNAME/" autofan.sh
|
||||||
wget https://raw.githubusercontent.com/That-Guy-Jack/HP-ILO-Fan-Control/main/Files/autofan.sh
|
sed -ri "s/your password/$ILOPASSWORD/" autofan.sh
|
||||||
echo "Downloaded autofan.sh, please change the placeholders with correct info"
|
sed -ri "s/your ilo ip/$ILOHOST/" autofan.sh
|
||||||
echo "Please cisit the GitHub page to follow the instructions!"
|
mv autofan.sh /
|
||||||
echo "https://github.com/That-Guy-Jack/HP-ILO-Fan-Control"
|
|
||||||
exit 1
|
echo -e "\e[92mDone! Please visit the GitHub page to follow the instructions!\e[0m"
|
||||||
elif [ $server = 2 ] ; then
|
echo -e "\e[1\https://github.com/That-Guy-Jack/HP-ILO-Fan-Control\e[0m"
|
||||||
echo "Preping autofan.sh for DL380p G8"
|
else
|
||||||
cd /
|
echo -e "\e[31m:( exiting\e[0m"
|
||||||
echo "Downloading latest autofan.sh"
|
exit 0
|
||||||
wget https://raw.githubusercontent.com/That-Guy-Jack/HP-ILO-Fan-Control/main/Files/autofan-dl380p-g8.sh
|
|
||||||
echo "Renaming file"
|
|
||||||
mv autofan-dl380p-g8.sh autofan.sh
|
|
||||||
echo "Downloaded autofan.sh, please change the placeholders with correct info"
|
|
||||||
echo "Please cisit the GitHub page to follow the instructions!"
|
|
||||||
echo "https://github.com/That-Guy-Jack/HP-ILO-Fan-Control"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo " :( exitting"
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user