sonic-buildimage/platform/broadcom/sonic-platform-modules-dell/common/onie_version
Arun Saravanan Balachandran 942bef4475
DellEMC: S6100, Z9332f - Include ONIE version in 'show platform firmware status' (#10493)
Why I did it
To include ONIE version in show platform firmware status command output in DellEMC S6100 and Z9332f platforms.

How I did it
Include ‘ONIE’ in the list of components provided by platform APIs in DellEMC S6100 and Z9332f.
Unmount ONIE-BOOT if mounted using fast/soft/warm-reboot plugins in DellEMC S6100.
2022-05-12 09:24:06 -07:00

29 lines
648 B
Bash
Executable File

#!/bin/bash
# script to get the ONIE version from NOS
ONIEPATH="/mnt/onie-boot"
# Exit if not superuser
if [[ "$EUID" -ne 0 ]]; then
echo "This command must be run as root" >&2
exit 1
fi
# Mount ONIE partition if not already mounted
if ! grep -qs ${ONIEPATH} /proc/mounts; then
mkdir -p ${ONIEPATH}
mount LABEL=ONIE-BOOT ${ONIEPATH} || ERR=$?
if [[ ${ERR} -ne 0 ]]; then
exit 1
fi
fi
# Get ONIE version
onie_version=$(${ONIEPATH}/onie/tools/bin/onie-version | grep "ONIE version") || ERR=$?
if [[ ${ERR} -ne 0 ]]; then
exit 1
fi
onie_version=$(echo ${onie_version} | awk '{print $NF}')
echo ${onie_version}