sonic-buildimage/files/build_templates/docker_image_ctl.j2
Joe LeVeque 2a551d3c60 Consolidate device-specific files; install as a Debian package (#316)
( All device-specific files now reside under /device directory in a <vendor-name>/<platform-string>/<hardware-SKU> directory structure in repo.

* Device-specific files are now packaged into a Debian package (sonic-device-data) and are now installed to /usr/share/sonic/device/<platform-string>/<hardware-SKU>/ directory on switch.
2017-02-27 00:13:36 -08:00

33 lines
871 B
Django/Jinja

#!/bin/bash
# Obtain our platform and HWSKU as we will mount directories with these names in each docker
PLATFORM=`/usr/bin/sonic-cfggen -v platform`
HWSKU=`/usr/bin/sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku`
start() {
docker inspect --type container {{docker_container_name}} &>/dev/null
if [ "$?" -eq "0" ]; then
docker start -a {{docker_container_name}}
else
docker run {{docker_image_run_opt}} \
-v /usr/share/sonic/device/$PLATFORM:/usr/share/sonic/platform:ro \
-v /usr/share/sonic/device/$PLATFORM/$HWSKU:/usr/share/sonic/hwsku:ro \
--name={{docker_container_name}} {{docker_image_name}}
fi
}
stop() {
docker stop {{docker_container_name}}
}
case "$1" in
start|stop)
$1
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esac