From e5a2e67551551974ff639873d78cebe64e7bab5e Mon Sep 17 00:00:00 2001 From: Leo Simons Date: Mon, 21 Jul 2014 11:01:56 +0200 Subject: [PATCH] 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. --- .../systemvmtemplate/configure_grub.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tools/appliance/definitions/systemvmtemplate/configure_grub.sh b/tools/appliance/definitions/systemvmtemplate/configure_grub.sh index d530bb93bf9..7978bec5301 100644 --- a/tools/appliance/definitions/systemvmtemplate/configure_grub.sh +++ b/tools/appliance/definitions/systemvmtemplate/configure_grub.sh @@ -1,5 +1,13 @@ +#!/bin/bash + +set -e +set -x + # Remove 5s grub timeout to speed up booting -cat < /etc/default/grub +function configure_grub() { + grep GRUB_TIMEOUT=0 /etc/default/grub && return + + cat < /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