sonic-buildimage/dockers/docker-platform-monitor/docker_init.j2
Junchao-Mellanox e592984991
[Mellanox] [201911] Support new sensor conf file for MSN4700 A1/A0 (#7536)
#### Why I did it

MSN4700 A1/A0 used different sensor chip but keep the existing platform name *x86_64-mlnx_msn4700-r0*, this is a workaround to replace the sensor conf on MSN4700 A1/A0

#### How I did it

Use a shell script to get the sensor conf path and copy that files to /etc/sensors.d/sensors.conf
2021-05-06 15:01:35 -07:00

51 lines
1.6 KiB
Django/Jinja
Executable File

#!/usr/bin/env bash
# Generate supervisord config file and the start.sh scripts
mkdir -p /etc/supervisor/conf.d/
SENSORS_CONF_FILE="/usr/share/sonic/platform/sensors.conf"
FANCONTROL_CONF_FILE="/usr/share/sonic/platform/fancontrol"
HAVE_SENSORS_CONF=0
HAVE_FANCONTROL_CONF=0
{% if CONFIGURED_PLATFORM == "mellanox" %}
SENSORS_CONF_PATH_GETTER="/usr/share/sonic/platform/get_sensors_conf_path"
if [ -e $SENSORS_CONF_PATH_GETTER ]; then
SENSORS_CONF_FILE=$($SENSORS_CONF_PATH_GETTER 2>&1)
fi
{% endif %}
if [ -e $SENSORS_CONF_FILE ]; then
HAVE_SENSORS_CONF=1
fi
if [ -e $FANCONTROL_CONF_FILE ]; then
HAVE_FANCONTROL_CONF=1
fi
confvar="{\"HAVE_SENSORS_CONF\":$HAVE_SENSORS_CONF, \"HAVE_FANCONTROL_CONF\":$HAVE_FANCONTROL_CONF}"
if [ -e /usr/share/sonic/platform/pmon_daemon_control.json ];
then
sonic-cfggen -j /usr/share/sonic/platform/pmon_daemon_control.json -a "$confvar" -t /usr/share/sonic/templates/docker-pmon.supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf
else
sonic-cfggen -a "$confvar" -t /usr/share/sonic/templates/docker-pmon.supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf
fi
# If this platform has an lm-sensors config file, copy it to its proper place
if [ $HAVE_SENSORS_CONF -eq 1 ]; then
mkdir -p /etc/sensors.d
/bin/cp -f $SENSORS_CONF_FILE /etc/sensors.d/sensors.conf
fi
# If this platform has a fancontrol config file, copy it to its proper place
if [ $HAVE_FANCONTROL_CONF -eq 1 ]; then
# Remove stale pid file if it exists
rm -f /var/run/fancontrol.pid
/bin/cp -f $FANCONTROL_CONF_FILE /etc/
fi
exec /usr/bin/supervisord