forked from wkettler/nexenta-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dell-bios.sh
100 lines (85 loc) · 2.51 KB
/
dell-bios.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
#
# dell-bios.sh
#
# Configure Dell BIOS per best practices.
#
# Copyright (C) 2014 Nexenta Systems
# William Kettler <[email protected]>
#
# ftp://ftp.dell.com/Manuals/all-products/esuprt_electronics/esuprt_software/esuprt_remote_ent_sys_mgmt/integrated-dell-remote-access-cntrllr-7-v1.30.30_Reference%20Guide_en-us.pdf
#
# Check command line parameters
if [ $# -ne 2 ]; then
echo Usage
echo -e "\t$0 [user@]host password"
exit 1
fi
host=$1
pass=$2
prompt() {
#
# Prompt user with a yes or no question.
#
read -p "$1 [y|n]: "
# If yes return 0
if [[ $REPLY == "y" ]]; then
return 0
# If no return 1
elif [[ $REPLY == "n" ]]; then
return 1
# If 'y' or 'n' was not entered re-prompt
else
$ECHO "Invalid input."
prompt "$1"
fi
}
racadm_set() {
#
# Set remote BIOS settings using ssh/racadm.
#
out=$(sshpass -p "$pass" ssh -o StrictHostKeyChecking=no "$host" "racadm set $1 $2" 2>&1)
# If sshpass fails best to exit immediately to avoid a hung iDRAC
if [ $? -ne 0 ]; then
echo "[FAILURE] sshpass"
echo "$out"
exit 1
fi
# We have no way of checking racadm return code so we must parse the output
# for an ERROR string
echo "$out" | grep -q ERROR
if [ $? -eq 0 ]; then
echo "[FAILURE] $1 $2"
echo "$out"
else
echo "[SUCCESS] $1 $2"
fi
}
# System profile
racadm_set BIOS.SysProfileSettings.SysProfile PerfOptimized
# Disable virtualization
racadm_set BIOS.ProcSettings.ProcVirtualization Disabled
# Disable embedded SATA
racadm_set BIOS.SataSettings.EmbSata Off
# Disable I/OAT DMA engine
racadm_set BIOS.IntegratedDevices.IoatEngine Disabled
# Disable SR-IOV
racadm_set BIOS.IntegratedDevices.SriovGlobalEnable Disabled
# Clean recovery from power failure
racadm_set BIOS.SysSecurity.AcPwrRcvry Last
racadm_set BIOS.SysSecurity.AcPwrRcvryDelay Immediate
# Boot mode
racadm_set BIOS.BiosBootSettings.BootMode Bios
# PCI slot disablement
racadm_set BIOS.SlotDisablement.Slot1 BootDriverDisabled
racadm_set BIOS.SlotDisablement.Slot2 BootDriverDisabled
racadm_set BIOS.SlotDisablement.Slot3 BootDriverDisabled
racadm_set BIOS.SlotDisablement.Slot4 BootDriverDisabled
racadm_set BIOS.SlotDisablement.Slot5 BootDriverDisabled
racadm_set BIOS.SlotDisablement.Slot6 BootDriverDisabled
racadm_set BIOS.SlotDisablement.Slot7 BootDriverDisabled
# Reboot
echo "A reboot is required for the new settings to take effect."
if prompt "Reboot now?"; then
reboot
fi