Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[grub]: use UUID for root partition #4443

Merged
merged 2 commits into from
Apr 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions installer/x86_64/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -583,19 +583,22 @@ EOF
$onie_root_dir/tools/bin/onie-boot-mode -q -o install
fi

# Add a menu entry for the DEMO OS
# Add a menu entry for the SONiC OS
# Note: assume that apparmor is supported in the kernel
demo_grub_entry="$demo_volume_revision_label"
if [ "$install_env" = "sonic" ]; then
old_sonic_menuentry=$(cat /host/grub/grub.cfg | sed "/$running_sonic_revision/,/}/!d")
demo_dev=$(echo $old_sonic_menuentry | sed -e "s/.*root\=\(.*\)rw.*/\1/")
grub_cfg_root=$(echo $old_sonic_menuentry | sed -e "s/.*root\=\(.*\)rw.*/\1/")
onie_menuentry=$(cat /host/grub/grub.cfg | sed "/menuentry ONIE/,/}/!d")
fi

if [ "$install_env" = "build" ]; then
elif [ "$install_env" = "build" ]; then
grub_cfg_root=%%SONIC_ROOT%%
else
grub_cfg_root=$demo_dev
else # install_env = "onie"
uuid=$(blkid "$demo_dev" | sed -ne 's/.* UUID=\"\([^"]*\)\".*/\1/p')
if [ -z "$uuid" ]; then
grub_cfg_root=$demo_dev
else
grub_cfg_root=UUID=$uuid
fi
fi

cat <<EOF >> $grub_cfg
Expand Down