Skip to content

Commit 96c1102

Browse files
committed
Fix extra "fi" and alter grub changes for grub vs grub2 in centos610.ks
1 parent ab1c01c commit 96c1102

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

ks/azure/centos610.ks

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,19 @@ curl -so /etc/pki/rpm-gpg/OpenLogic-GPG-KEY https://raw.githubusercontent.com/op
105105
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
106106
rpm --import /etc/pki/rpm-gpg/OpenLogic-GPG-KEY
107107

108-
# Enforce GRUB_TIMEOUT=1 and remove any existing GRUB_TIMEOUT_STYLE and append GRUB_TIMEOUT_STYLE=countdown after GRUB_TIMEOUT
109-
sed -i -n -e 's/GRUB_TIMEOUT=.*/GRUB_TIMEOUT=1/' -e '/^GRUB_TIMEOUT_STYLE=/!p' -e '/^GRUB_TIMEOUT=/aGRUB_TIMEOUT_STYLE=countdown' /etc/default/grub
108+
# Grab major version number so we can properly adjust grub config.
109+
# Should work on both RHEL and CentOS reliably
110+
majorVersion=$(rpm -E %{rhel})
111+
112+
[ "$majorVersion" = "6" ] && {
113+
# GRUB: Enforce timeout=1 and append hiddenmenu after splashimage, if necessary
114+
sed -i -e 's/timeout=.*/timeout=1/' /boot/grub/grub.conf
115+
grep -q ^hiddenmenu /boot/grub/grub.conf || sed -i -e '/^splashimage=/ahiddenmenu' /boot/grub/grub.conf
116+
}
117+
[ "$majorVersion" != "6" ] && {
118+
# GRUB2: Enforce GRUB_TIMEOUT=1 and remove any existing GRUB_TIMEOUT_STYLE and append GRUB_TIMEOUT_STYLE=countdown after GRUB_TIMEOUT
119+
sed -i -n -e 's/GRUB_TIMEOUT=.*/GRUB_TIMEOUT=1/' -e '/^GRUB_TIMEOUT_STYLE=/!p' -e '/^GRUB_TIMEOUT=/aGRUB_TIMEOUT_STYLE=countdown' /etc/default/grub
120+
}
110121

111122
# Enable SSH keepalive
112123
sed -i 's/^#\(ClientAliveInterval\).*$/\1 180/g' /etc/ssh/sshd_config
@@ -165,8 +176,6 @@ then
165176
EOF
166177
fi
167178

168-
fi
169-
170179
# Download these again at the end of the post-install script so we can recreate a previous point release without current major version updates
171180
# Set OL repos
172181
curl -so /etc/yum.repos.d/CentOS-Base.repo https://raw.githubusercontent.com/openlogic/AzureBuildCentOS/master/config/azure/CentOS-Base.repo

0 commit comments

Comments
 (0)