From 62932296ae168535923b7bc85665d87b7d41ce5d Mon Sep 17 00:00:00 2001 From: vadymhlushko-mlnx Date: Fri, 24 Nov 2023 19:18:22 +0200 Subject: [PATCH] remove exit codes, add mlnx if fi Signed-off-by: vadymhlushko-mlnx --- scripts/reboot | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/scripts/reboot b/scripts/reboot index 5dc5e54b17..68a949084d 100755 --- a/scripts/reboot +++ b/scripts/reboot @@ -1,8 +1,5 @@ #!/bin/bash -x -declare -r EXIT_SUCCESS="0" -declare -r EXIT_ERROR="1" - DEVPATH="/usr/share/sonic/device" PLAT_REBOOT="platform_reboot" PLATFORM_UPDATE_REBOOT_CAUSE="platform_update_reboot_cause" @@ -128,7 +125,7 @@ function show_help_and_exit() echo " -h, -? : getting this help" echo " -f : execute reboot force" - exit "${EXIT_SUCCESS}" + exit 0 } function setup_reboot_variables() @@ -200,7 +197,7 @@ parse_options $@ # Exit if not superuser if [[ "$EUID" -ne 0 ]]; then echo "This command must be run as root" >&2 - exit "${EXIT_ERROR}" + exit 1 fi debug "User requested rebooting device ..." @@ -254,12 +251,6 @@ if [ -x ${DEVPATH}/${PLATFORM}/${PLAT_REBOOT} ]; then VERBOSE=yes debug "Rebooting with platform ${PLATFORM} specific tool ..." ${DEVPATH}/${PLATFORM}/${PLAT_REBOOT} ${FLAGS} - EXIT_CODE="$?" - - if [[ "${EXIT_CODE}" == "${EXIT_SUCCESS}" ]]; then - exit "${EXIT_SUCCESS}" - fi - # There are a couple reasons execution reaches here: # # 1. The vendor platform reboot returned after scheduled the platform specific reboot. @@ -268,9 +259,11 @@ if [ -x ${DEVPATH}/${PLATFORM}/${PLAT_REBOOT} ]; then # # As result if the reboot script reaches here. We should make the reboot happen. # Sleep 1 second before calling /sbin/reboot to accommodate situation #1 above. - sleep 1 + if [[ x"$ASIC_TYPE" != x"mellanox" ]]; then + sleep 1 - VERBOSE=yes debug "Platform specific reboot failed!" >&2 + VERBOSE=yes debug "Platform specific reboot failed!" >&2 + fi fi VERBOSE=yes debug "Issuing OS-level reboot ..." >&2