-
Notifications
You must be signed in to change notification settings - Fork 39
/
install.sh
79 lines (61 loc) · 2.23 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
if [ $(id -u) -ne 0 ]; then
echo -e "\e[31mThis must be run as root!\e[0m"
exit 126
fi
echo "You are about to download and install the required items for HP ILO4 fan control."
read -rep "Do you accept? (y/N): " ACCEPTED
if [[ ${ACCEPTED,,} =~ ^[y] ]]; then
mkdir -p ~/autofan
cd ~/autofan
echo "Installing required packages..."
apt install sshpass wget lm-sensors jq -y
echo -e "\e[92mDownloading ILO_250 for ROM upgrade\e[0m"
wget -q https://github.com/That-Guy-Jack/HP-ILO-Fan-Control/tree/main/Files/ilo_250
echo -e "\e[92m Creating autofan service\e[0m"
wget -q https://raw.githubusercontent.com/That-Guy-Jack/HP-ILO-Fan-Control/main/Files/autofan.service
mv autofan.service /etc/systemd/system/
echo -e "\e[92m autofan service created\e[0m"
read -rep $'Which server are you running? (Enter 1-4)
1. DL360p G8 (No ESXi)
2. DL380p G8 (no ESXi)
3. DL360p G8 (ESXi-based)
4. DL380p G8 (ESXi-based)\n' HOSTCHOICE
case $HOSTCHOICE in
1)
AUTOFANFILE="autofan.sh"
HOSTTYPE="DL360p G8 (No ESXi)"
;;
2)
AUTOFANFILE="autofan-dl380p-g8.sh"
HOSTTYPE="DL380p G8 (No ESXi)"
;;
3)
AUTOFANFILE="autofan-dl360p-g8-EXSI.sh"
HOSTTYPE="DL360p G8 (ESXi-based)"
;;
4)
AUTOFANFILE="autofan-dl380p-g8-EXSI.sh"
HOSTTYPE="DL370p G8 (ESXi-based)"
;;
*)
echo -e "\e[31mInvalid choice. Exiting.\e[0m"
exit 1
;;
esac
echo "Preping autofan.sh for $HOSTTYPE"
echo "Downloading latest autofan.sh"
wget -q https://raw.githubusercontent.com/That-Guy-Jack/HP-ILO-Fan-Control/main/Files/$AUTOFANFILE -O autofan.sh
read -rep 'Enter iLO Username: ' ILOUSERNAME
read -rep 'Enter iLO Password: ' ILOPASSWORD
read -rep 'Enter iLO IP/hostname: ' ILOHOST
sed -ri "s/your username/$ILOUSERNAME/" autofan.sh
sed -ri "s/your password/$ILOPASSWORD/" autofan.sh
sed -ri "s/your ilo ip/$ILOHOST/" autofan.sh
mv autofan.sh /
echo -e "\e[92mDone! Please visit the GitHub page to follow the instructions!\e[0m"
echo -e "\e[1\https://github.com/That-Guy-Jack/HP-ILO-Fan-Control\e[0m"
else
echo -e "\e[31m:( exiting\e[0m"
exit 0
fi