Skip to content

Commit

Permalink
[rc.local] separate configuration migration and grub installation log…
Browse files Browse the repository at this point in the history
…ic (#5528)

To address issue #5525

Explicitly control the grub installation requirement when it is needed.
We have scenario where configuration migration happened but grub
installation is not required.

Signed-off-by: Ying Xie <ying.xie@microsoft.com>
  • Loading branch information
yxieca authored Oct 4, 2020
1 parent dbea3bb commit ec01530
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion files/image_config/platform/rc.local
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ logger "SONiC version ${SONIC_VERSION} starting up..."

# If the machine.conf is absent, it indicates that the unit booted
# into SONiC from another NOS. Extract the machine.conf from ONIE.
grub_installation_needed=""
if [ ! -e /host/machine.conf ]; then
onie_dev=$(blkid | grep ONIE-BOOT | head -n 1 | awk '{print $1}' | sed -e 's/:.*$//')
mkdir -p /mnt/onie-boot
Expand All @@ -213,6 +214,7 @@ if [ ! -e /host/machine.conf ]; then
eval val='$'onie_$var
echo "onie_${var}=${val}" >> /host/machine.conf
done
grub_installation_needed="TRUE"
fi

umount /mnt/onie-boot
Expand Down Expand Up @@ -277,7 +279,7 @@ if [ -f $FIRST_BOOT_FILE ]; then

# If the unit booted into SONiC from another NOS's grub,
# we now install a grub for SONiC.
if [ -n "$onie_platform" ] && [ -n "$migration" ]; then
if [ -n "$onie_platform" ] && [ -n "$grub_installation_needed" ]; then

grub_bin=$(ls /host/image-$SONIC_VERSION/platform/x86_64-grub/grub-pc-bin*.deb 2> /dev/null)
if [ -z "$grub_bin" ]; then
Expand Down

0 comments on commit ec01530

Please sign in to comment.