From 31f71ac961a1784d7684ef8bb4350d047c3d3a3b Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 17 Jun 2022 09:06:33 -0400 Subject: [PATCH] Adjust to correct ntp for 9 and up --- .../el8/profiles/default/scripts/pre.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/confluent_osdeploy/el8/profiles/default/scripts/pre.sh b/confluent_osdeploy/el8/profiles/default/scripts/pre.sh index 11bff85a..83bf1802 100644 --- a/confluent_osdeploy/el8/profiles/default/scripts/pre.sh +++ b/confluent_osdeploy/el8/profiles/default/scripts/pre.sh @@ -42,11 +42,20 @@ echo lang $locale > /tmp/langinfo echo keyboard --vckeymap=$keymap >> /tmp/langinfo tz=$(grep ^timezone: /etc/confluent/confluent.deploycfg) tz=${tz#timezone: } +MVER=$(grep VERSION_ID /etc/os-release|cut -d = -f 2 |cut -d . -f 1|cut -d '"' -f 2) ntpsrvs="" -if grep ^ntpservers: /etc/confluent/confluent.deploycfg > /dev/null; then - ntpsrvs="--ntpservers="$(sed -n '/^ntpservers:/,/^[^-]/p' /etc/confluent/confluent.deploycfg|sed 1d|sed '$d' | sed -e 's/^- //' | paste -sd,) +if [ "$MVER" -ge 9 ]; then + if grep ^ntpservers: /etc/confluent/confluent.deploycfg > /dev/null; then + for ntpsrv in $(sed -n '/^ntpservers:/,/^[^-]/p' /etc/confluent/confluent.deploycfg|sed 1d|sed '$d' | sed -e 's/^- //'); do + echo timesource --ntp-server $ntpsrv >> /tmp/timezone + done + fi +else + if grep ^ntpservers: /etc/confluent/confluent.deploycfg > /dev/null; then + ntpsrvs="--ntpservers="$(sed -n '/^ntpservers:/,/^[^-]/p' /etc/confluent/confluent.deploycfg|sed 1d|sed '$d' | sed -e 's/^- //' | paste -sd,) + fi fi -echo timezone $ntpsrvs $tz --utc > /tmp/timezone +echo timezone $ntpsrvs $tz --utc >> /tmp/timezone rootpw=$(grep ^rootpassword /etc/confluent/confluent.deploycfg | awk '{print $2}') if [ "$rootpw" = null ]; then echo "rootpw --lock" > /tmp/rootpw