2017-05-08 17:43:31 -05:00
|
|
|
#!/usr/bin/env bash
|
2016-07-26 14:01:58 -05:00
|
|
|
|
2017-06-20 18:37:07 -05:00
|
|
|
PLATFORM_DIR=/usr/share/sonic/platform
|
2018-03-21 11:28:23 -05:00
|
|
|
HWSKU_DIR=/usr/share/sonic/hwsku
|
2017-06-20 18:37:07 -05:00
|
|
|
|
2018-10-18 16:07:30 -05:00
|
|
|
SYNCD_SOCKET_FILE=/var/run/sswsyncd/sswsyncd.socket
|
|
|
|
|
|
|
|
# Function: wait until syncd has created the socket for bcmcmd to connect to
|
|
|
|
wait_syncd() {
|
|
|
|
while true; do
|
|
|
|
if [ -e ${SYNCD_SOCKET_FILE} ]; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
|
|
|
|
# wait until bcm sdk is ready to get a request
|
|
|
|
sleep 3
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Remove stale files if they exist
|
2017-05-08 17:43:31 -05:00
|
|
|
rm -f /var/run/rsyslogd.pid
|
2018-10-18 16:07:30 -05:00
|
|
|
rm -f ${SYNCD_SOCKET_FILE}
|
2016-09-09 19:53:41 -05:00
|
|
|
|
2017-05-08 17:43:31 -05:00
|
|
|
supervisorctl start rsyslogd
|
2016-09-09 19:53:41 -05:00
|
|
|
|
2018-03-21 11:28:23 -05:00
|
|
|
mkdir -p /etc/sai.d/
|
|
|
|
|
|
|
|
# Create/Copy the sai.profile to /etc/sai.d/sai.profile
|
|
|
|
if [ -f $HWSKU_DIR/sai.profile.j2 ]; then
|
|
|
|
sonic-cfggen -d -t $HWSKU_DIR/sai.profile.j2 > /etc/sai.d/sai.profile
|
|
|
|
else
|
|
|
|
if [ -f $HWSKU_DIR/sai.profile ]; then
|
|
|
|
cp $HWSKU_DIR/sai.profile /etc/sai.d/sai.profile
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2017-05-08 17:43:31 -05:00
|
|
|
supervisorctl start syncd
|
2016-09-09 19:53:41 -05:00
|
|
|
|
2017-08-08 23:19:50 -05:00
|
|
|
# If this platform has an initialization file for the Broadcom LED microprocessor, load it
|
2018-11-21 19:56:19 -06:00
|
|
|
if [ -r ${PLATFORM_DIR}/led_proc_init.soc && ! -f /var/warmboot/warm-starting ]; then
|
2017-08-08 23:19:50 -05:00
|
|
|
wait_syncd
|
2018-06-29 10:37:20 -05:00
|
|
|
supervisorctl start ledinit
|
2017-06-20 18:37:07 -05:00
|
|
|
fi
|