Add new file
This commit is contained in:
commit
e94f272209
1 changed files with 76 additions and 0 deletions
76
install.sh
Normal file
76
install.sh
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
bye() {
|
||||||
|
echo "$1"
|
||||||
|
cd /
|
||||||
|
rm -rf $orig_dir
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
orig_dir=`pwd`
|
||||||
|
|
||||||
|
# Make sure this is a NV
|
||||||
|
if ! grep -q "model:.*ReadyNAS NV" /proc/sys/dev/boot/info; then
|
||||||
|
mesg="Unsuccessful setting minimum fan speed. Wrong system detected."
|
||||||
|
bye "$mesg"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Make sure this is running the right system rev
|
||||||
|
if ! grep -q "system_rev:.*0005" /proc/sys/dev/boot/info; then
|
||||||
|
mesg="Unsuccessful setting minimum fan speed. Wrong system rev detected."
|
||||||
|
bye "$mesg"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Check fan speed to make sure it's in range. This tells us if the fan
|
||||||
|
# adapter is installed
|
||||||
|
echo 255 > /proc/sys/dev/hwmon/fan0_speed_control
|
||||||
|
sleep 5
|
||||||
|
speed=`cat /proc/sys/dev/hwmon/fan_0`
|
||||||
|
|
||||||
|
if [ $speed -gt 2500 ]; then
|
||||||
|
mesg="Unsuccessful setting minimum fan speed. Fan adapter not installed."
|
||||||
|
bye "$mesg"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# After install fan adaptor, change VPD to version 4
|
||||||
|
|
||||||
|
# Remove USB modules if neccessary
|
||||||
|
rmmod usb-uhci ehci-hcd
|
||||||
|
if lsmod | egrep -q "usb-uhci|ehci-hcd"; then
|
||||||
|
mesg="Unsuccessful setting minimum fan speed. Disconnect USB devices and try again."
|
||||||
|
bye "$mesg"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Temp working directory, use system temp if possible
|
||||||
|
mkdir vpd_change_temp_dir
|
||||||
|
cd vpd_change_temp_dir
|
||||||
|
|
||||||
|
# Min RPM 1900 / 64 = 29 = 0x1d * 64 = 1856 RPM
|
||||||
|
printf "\x1d" > min_rpm
|
||||||
|
dd if=min_rpm of=/dev/mtdblock0 bs=1 seek=33153 count=1
|
||||||
|
|
||||||
|
# Min PWM 16
|
||||||
|
printf "\x10" > min_pwm
|
||||||
|
dd if=min_pwm of=/dev/mtdblock0 bs=1 seek=33154 count=1
|
||||||
|
|
||||||
|
# CFT PWM 255
|
||||||
|
printf "\xff" > cft_pwm
|
||||||
|
dd if=cft_pwm of=/dev/mtdblock0 bs=1 seek=33155 count=1
|
||||||
|
|
||||||
|
# Change System revision number
|
||||||
|
printf "\x04" > sys_rev
|
||||||
|
dd if=sys_rev of=/dev/mtdblock0 bs=1 seek=33159
|
||||||
|
|
||||||
|
# Force fan recalibration
|
||||||
|
rm -f /etc/frontview/fan_setting_*
|
||||||
|
|
||||||
|
|
||||||
|
# Clean up
|
||||||
|
cd ..
|
||||||
|
rm -rf vpd_change_temp_dir
|
||||||
|
|
||||||
|
mesg="Successfully set minimum fan speed. Please reboot the ReadyNAS now."
|
||||||
|
bye "$mesg"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue