Skip to content

Commit

Permalink
[onie-fw-update]remove find_onie_menuentry.
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen Sun committed Jan 23, 2020
1 parent 08d885a commit c3fa992
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions platform/mellanox/onie-fw-update
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ this_script=${ONIE_FWPKG_PROGRAM_NAME:-$(basename $(realpath $0))}
onie_mount=/mnt/onie-boot
os_boot=/host
onie_partition=
onie_entry=0

export ONIE_FWPKG_PROGRAM_NAME=$(basename $(realpath $0))

Expand Down Expand Up @@ -45,28 +44,9 @@ clean_onie_access()
umount $onie_partition
}

# ONIE entry must exist in grub config
find_onie_menuentry()
{
onie_entry="$(cat $os_boot/grub/grub.cfg | grep -e 'menuentry' | cat -n | awk '$0~/ONIE/ {print $1-1}')"
entries_num="$(echo "$onie_entry" | grep -E '^[0-9]+$' | wc -l)"
if [ $entries_num -eq 1 ] && [ $onie_entry -ge 1 ]; then
return 0
fi
return 1
}

change_grub_boot_order()
{
find_onie_menuentry
rc=$?
if [ $rc -eq 0 ]; then
grub-editenv $os_boot/grub/grubenv set onie_entry=ONIE
else
echo "ERROR: ONIE entry wasn't found in grub config"
return 1
fi

grub-editenv $os_boot/grub/grubenv set onie_entry=ONIE
grub-editenv $onie_mount/grub/grubenv set onie_mode=update
return 0
}
Expand Down

0 comments on commit c3fa992

Please sign in to comment.