[installer]: Add support for grub-set-default. (#532)

Its needed for Azure/sonic-utilities#40 for user to set default image for boot.

grub-set-default utility writes to value of saved_entry variable to grubenv.
https://www.gnu.org/software/grub/manual/legacy/Invoking-grub_002dset_002ddefault.html
This patch provides support for grub-set-default to allow user choose a default image to boot from.

Signed-off-by: marian-pritsak <marianp@mellanox.com>
This commit is contained in:
Marian Pritsak 2017-04-25 16:53:17 +03:00 committed by lguohan
parent f28790ce9a
commit 035b08b9c4

View File

@ -489,11 +489,14 @@ set timeout=5
EOF EOF
# Add the logic to support grub-reboot # Add the logic to support grub-reboot and grub-set-default
cat <<EOF >> $grub_cfg cat <<EOF >> $grub_cfg
if [ -s \$prefix/grubenv ]; then if [ -s \$prefix/grubenv ]; then
load_env load_env
fi fi
if [ "\${saved_entry}" ] ; then
set default="\${saved_entry}"
fi
if [ "\${next_entry}" ] ; then if [ "\${next_entry}" ] ; then
set default="\${next_entry}" set default="\${next_entry}"
set next_entry= set next_entry=