CLOUDSTACK-7143: cleanup configure_gruh.sh code

Adding a check whether GRUB_TIMEOUT has already been set, and if it has,
skip re-running update-grub.
This commit is contained in:
Leo Simons 2014-07-21 11:01:56 +02:00 committed by Rohit Yadav
parent 29c1f91aea
commit e5a2e67551
1 changed files with 13 additions and 2 deletions

View File

@ -1,5 +1,13 @@
#!/bin/bash
set -e
set -x
# Remove 5s grub timeout to speed up booting
cat <<EOF > /etc/default/grub
function configure_grub() {
grep GRUB_TIMEOUT=0 /etc/default/grub && return
cat <<EOF > /etc/default/grub
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
@ -10,4 +18,7 @@ GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX="debian-installer=en_US"
EOF
update-grub
update-grub
}
return 2>/dev/null || configure_grub