2017-07-18 13:21:24 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
### BEGIN INIT INFO
|
|
|
|
# Provides: setup-board
|
|
|
|
# Required-Start:
|
|
|
|
# Required-Stop:
|
|
|
|
# Should-Start:
|
|
|
|
# Should-Stop:
|
|
|
|
# Default-Start: S
|
|
|
|
# Default-Stop: 0 6
|
|
|
|
# Short-Description: Setup Inventec d7032q28b board.
|
|
|
|
### END INIT INFO
|
|
|
|
|
2018-08-12 14:39:20 -05:00
|
|
|
DIR=/usr/share/sonic/device/x86_64-inventec_d7032q28b-r0/plugins
|
|
|
|
MONITOR_DAEMON=$DIR/transceiver_monitor.py
|
|
|
|
MONITOR_DAEMON_NAME=transceiver_monitor
|
|
|
|
LED_DAEMON=$DIR/led_proc.py
|
|
|
|
LED_DAEMON_NAME=led_proc
|
|
|
|
|
|
|
|
# The process ID of the script when it runs is stored here:
|
|
|
|
MONITOR_PIDFILE=/var/run/$MONITOR_DAEMON_NAME.pid
|
|
|
|
LED_PIDFILE=/var/run/$LED_DAEMON_NAME.pid
|
|
|
|
|
|
|
|
do_monitor_start() {
|
|
|
|
/sbin/start-stop-daemon --quiet --oknodo --pidfile $LED_PIDFILE --make-pidfile --startas $LED_DAEMON --start --background -- $DAEMON_OPTS
|
|
|
|
/sbin/start-stop-daemon --quiet --oknodo --pidfile $MONITOR_PIDFILE --make-pidfile --startas $MONITOR_DAEMON --start --background -- $DAEMON_OPTS
|
|
|
|
}
|
|
|
|
|
|
|
|
do_monitor_stop() {
|
|
|
|
/sbin/start-stop-daemon --quiet --oknodo --stop --pidfile $MONITOR_PIDFILE --retry 10
|
|
|
|
/sbin/start-stop-daemon --quiet --oknodo --stop --pidfile $LED_PIDFILE --retry 10
|
|
|
|
}
|
|
|
|
|
2017-07-18 13:21:24 -05:00
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
echo -n "Setting up board... "
|
|
|
|
|
2017-10-19 15:06:03 -05:00
|
|
|
depmod -a
|
|
|
|
/usr/local/bin/inventec_d7032_util.py -f install
|
2018-08-12 14:39:20 -05:00
|
|
|
do_monitor_${1}
|
2017-07-18 13:21:24 -05:00
|
|
|
echo "done."
|
|
|
|
;;
|
|
|
|
|
|
|
|
stop)
|
2017-10-19 15:06:03 -05:00
|
|
|
|
|
|
|
/usr/local/bin/inventec_d7032_util.py -f clean
|
2018-08-12 14:39:20 -05:00
|
|
|
do_monitor_${1}
|
2017-07-18 13:21:24 -05:00
|
|
|
echo "done."
|
|
|
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
force-reload|restart)
|
|
|
|
echo "Not supported"
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
echo "Usage: /etc/init.d/platform-modules-d7032q28b.init {start|stop}"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|