From 4290b83bbae440efd7e733b00faa7091f314264f Mon Sep 17 00:00:00 2001 From: ubuntu Date: Sun, 11 Apr 2021 21:42:37 -0700 Subject: [PATCH 1/2] [201811] platform pre-check for reboot --- scripts/reboot | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/reboot b/scripts/reboot index 871dbf2945..411abf0042 100755 --- a/scripts/reboot +++ b/scripts/reboot @@ -8,6 +8,7 @@ DEVPATH="/usr/share/sonic/device" PLAT_REBOOT="platform_reboot" SSD_FW_UPDATE="ssd-fw-upgrade" REBOOT_CAUSE_FILE="/host/reboot-cause/reboot-cause.txt" +PLATFORM_REBOOT_PRE_CHECK="platform_reboot_pre_check" VERBOSE=no EXIT_NEXT_IMAGE_NOT_EXISTS=4 @@ -73,6 +74,11 @@ function reboot_pre_check() fi rm ${filename} + if [ -x ${DEVPATH}/${PLATFORM}/${PLATFORM_REBOOT_PRE_CHECK} ]; then + ${DEVPATH}/${PLATFORM}/${PLATFORM_REBOOT_PRE_CHECK} + [[ $? -ne 0 ]] && exit + fi + # Make sure that the next image exists if [[ ! -d ${IMAGE_PATH} ]]; then VERBOSE=yes debug "Next image ${NEXT_SONIC_IMAGE} doesn't exist ..." From 326dbce5c76af8defd84cccfb1df325fbcee7f35 Mon Sep 17 00:00:00 2001 From: Santhosh Kumar T <53558409+santhosh-kt@users.noreply.github.com> Date: Wed, 21 Apr 2021 20:51:45 +0530 Subject: [PATCH 2/2] Adding exit code --- scripts/reboot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/reboot b/scripts/reboot index 411abf0042..8bebeb9c89 100755 --- a/scripts/reboot +++ b/scripts/reboot @@ -76,7 +76,7 @@ function reboot_pre_check() if [ -x ${DEVPATH}/${PLATFORM}/${PLATFORM_REBOOT_PRE_CHECK} ]; then ${DEVPATH}/${PLATFORM}/${PLATFORM_REBOOT_PRE_CHECK} - [[ $? -ne 0 ]] && exit + [[ $? -ne 0 ]] && exit $? fi # Make sure that the next image exists