sonic-buildimage/files/scripts/gbsyncd-platform.sh
Junhua Zhai 240596ec7d
[gearbox] provide common gbsyncd.service.j2 to start for platform specific gbsyncd docker (#9332)
Why I did it
Fix #9059. It provides common gbsyncd.service.j2 to start for platform specific gbsyncd docker, which must be named 'gbsyncd'.

How I did it
All of platform specific gbsyncd dockers use a common name 'gbsyncd'
Use a unique systemd service template gbsyncd.service.j2 for gbsyncd docker
2021-11-23 10:44:29 -08:00

28 lines
655 B
Bash
Executable File

#!/bin/bash
# Check the gbsyncd platform defined on the device matching the service,
# or otherwise skip starting the service
SERVICE="$gbsyncd_platform"
PLATFORM=${PLATFORM:-`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`}
DEVPATH="/usr/share/sonic/device"
CONFIGFILE="${DEVPATH}/${PLATFORM}/gbsyncd.ini"
# Skip checking the service for vs
[ "$sonic_asic_platform" = vs ] && exit 0
if [ ! -f "$CONFIGFILE" ]; then
exit 1
fi
while IFS="=" read -r key value; do
case "$key" in
platform)
if [[ "$value" = "$SERVICE"* ]]; then
exit 0
fi
;;
esac
done < "$CONFIGFILE"
exit 1