2019-04-10 21:13:30 -05:00
|
|
|
#! /bin/sh
|
|
|
|
|
|
|
|
### BEGIN INIT INFO
|
|
|
|
# Provides: fancontrol
|
|
|
|
# Required-Start: $remote_fs
|
|
|
|
# Required-Stop: $remote_fs
|
|
|
|
# Default-Start: 2 3 4 5
|
|
|
|
# Default-Stop:
|
|
|
|
# Short-Description: fancontrol
|
2021-05-03 11:14:35 -05:00
|
|
|
# Description: fancontrol configuration selector
|
2019-04-10 21:13:30 -05:00
|
|
|
### END INIT INFO
|
|
|
|
|
|
|
|
. /lib/lsb/init-functions
|
|
|
|
|
|
|
|
[ -f /etc/default/rcS ] && . /etc/default/rcS
|
|
|
|
MAIN_CONF=/usr/share/sonic/device/x86_64-cel_e1031-r0/fancontrol
|
2021-05-03 11:14:35 -05:00
|
|
|
PLATFORM_PATH=/sys/devices/platform/e1031.smc
|
2019-04-10 21:13:30 -05:00
|
|
|
|
2021-05-03 11:14:35 -05:00
|
|
|
init() {
|
|
|
|
FANDIR=$(cat ${PLATFORM_PATH}/fan1_dir)
|
|
|
|
CONF=${MAIN_CONF}-${FANDIR}
|
|
|
|
echo $FANDIR > /usr/share/sonic/device/x86_64-cel_e1031-r0/fan_airflow
|
|
|
|
}
|
2019-04-10 21:13:30 -05:00
|
|
|
|
2021-05-03 11:14:35 -05:00
|
|
|
install() {
|
|
|
|
find /var/lib/docker/overlay*/ -path */sbin/fancontrol -exec cp /usr/local/bin/fancontrol {} \;
|
|
|
|
}
|
2019-04-10 21:13:30 -05:00
|
|
|
|
|
|
|
case "$1" in
|
2021-05-03 11:14:35 -05:00
|
|
|
start)
|
|
|
|
init
|
|
|
|
cp $CONF $MAIN_CONF
|
|
|
|
;;
|
|
|
|
install)
|
|
|
|
install
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
log_success_msg "Usage: /etc/init.d/fancontrol {start} | {install}"
|
|
|
|
exit 1
|
|
|
|
;;
|
2019-04-10 21:13:30 -05:00
|
|
|
esac
|
|
|
|
|
2021-05-03 11:14:35 -05:00
|
|
|
exit 0
|