2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-11-20 17:32:21 +00:00
Files
confluent/confluent_osdeploy/suse16/profiles/server/scripts/pre.sh
T
Markus Hilger 903a9f2c9a Add deployment.installedargs for per-node installed kernel arguments
Kernel arguments for the installed OS could only be set per profile,
with installedargs in profile.yaml. deployment.installedargs sets them
per node or group, appended after the ones of the profile.

The deploycfg served to the node carries the value as installedargs,
and the installers add it wherever they add the profile installedargs:
the kickstart bootloader line on EL and RHVH, the AutoYaST and Agama
bootloader settings on SUSE, and GRUB_CMDLINE_LINUX on Debian and
Ubuntu. Diskless images installed to disk add it to GRUB_CMDLINE_LINUX,
and on EL9 and EL10 also to /etc/kernel/cmdline and the boot loader
entries.

deploycfg is no longer wrapped at 80 columns, since the scripts read
each value from its single line.
2026-11-18 23:44:04 +01:00

84 lines
3.8 KiB
Bash

#!/bin/bash
# This script runs before the installer executes, and sets up ssh during install as well
# as rewriting the autoinstall file with any substitutions prior to it being evaluated for real
exec >> /tmp/confluent-pre.log
exec 2>> /tmp/confluent-pre.log
chmod 600 /tmp/confluent-pre.log
cryptboot=$(grep encryptboot: /etc/confluent/confluent.deploycfg|sed -e 's/^encryptboot: //')
if [ "$cryptboot" != "" ] && [ "$cryptboot" != "none" ] && [ "$cryptboot" != "null" ]; then
echo "****Encrypted boot requested, but not implemented for this OS, halting install"
while :; do sleep 86400; done
fi
cp /etc/confluent/tls/*.pem /etc/pki/trust/anchors/
update-ca-certificates
echo "Initializing SSH"
for pubkey in /etc/ssh/ssh_host_*key.pub; do
privfile=${pubkey%.pub}
certfile=${pubkey/.pub/-cert.pub}
python3 /opt/confluent/bin/apiclient /confluent-api/self/sshcertready
python3 /opt/confluent/bin/apiclient /confluent-api/self/sshcert $pubkey > $certfile
if [ -s $certfile ]; then
echo HostCertificate $certfile >> /etc/ssh/sshd_config.d/20_hostkeys.conf
fi
done
systemctl restart sshd
python3 /opt/confluent/bin/apiclient /confluent-public/os/$profile/autoinstall.json > /tmp/autoinstall.json
deployserver=$(grep ^deploy_server: /etc/confluent/confluent.deploycfg|awk '{print $2}')
if [ -z "$deployserver" ] || [ "$deployserver" = "none" ] || [ "$deployserver" = "null" ]; then
deployserver=$(grep ^deploy_server_v6: /etc/confluent/confluent.deploycfg|awk '{print $2}')
fi
if [[ "$deployserver" == *":"* ]]; then
deployserver="[$deployserver]"
fi
source /etc/confluent/functions
hostname $(grep ^NODENAME: /etc/confluent/confluent.info|awk '{print $2}')
run_remote_parts pre.d
sed -i s!%%DEPLOYER%%!$deployserver!g /tmp/autoinstall.json
sed -i s!%%PROFILE%%!$(grep ^profile: /etc/confluent/confluent.deploycfg|awk '{print $2}')!g /tmp/autoinstall.json
rootpw=$(grep ^rootpassword: /etc/confluent/confluent.deploycfg|awk '{print $2}')
if [ "$rootpw" = "null" ]; then
# lock the account, as 15 does. ! is a marker, not a hash anything matches
rootpw='!'
fi
sed -i 's@%%ROOTPASSWORD%%@'"$rootpw"'@g' /tmp/autoinstall.json
sed -i s!%%NODENAME%%!$(hostname)!g /tmp/autoinstall.json
python3 /opt/confluent/bin/apiclient /confluent-public/os/$profile/profile.yaml > /tmp/instprofile.yaml
blargs=$(grep ^installedargs: /tmp/instprofile.yaml | sed -e 's/#.*//' -e 's/^installedargs: //')
nodeargs=$(confluent_installedargs)
if [ -n "$nodeargs" ]; then blargs="${blargs:+$blargs }$nodeargs"; fi
blargs=$(printf '%s' "$blargs" | sed -e 's/[\\"]/\\&/g' -e 's/[\\&!]/\\&/g')
sed -i 's!%%INSTALLEDARGS%%!'"$blargs"'!g' /tmp/autoinstall.json
python3 /opt/confluent/bin/apiclient /confluent-public/os/$profile/scripts/getinstalldisk > /tmp/getinstalldisk
locale=$(grep ^locale: /etc/confluent/confluent.deploycfg)
locale=${locale#locale: }
keymap=$(grep ^keymap: /etc/confluent/confluent.deploycfg)
keymap=${keymap#keymap: }
tz=$(grep ^timezone: /etc/confluent/confluent.deploycfg)
tz=${tz#timezone: }
# agama checks against the tzdata list, which carries UTC but no Etc/ zones
if [ "$tz" = "Etc/UTC" ]; then
tz=UTC
fi
sed -i 's!%%TIMEZONE%%!'$tz'!g' /tmp/autoinstall.json
sed -i 's!%%LOCALE%%!'$locale'!g' /tmp/autoinstall.json
sed -i 's!%%KEYMAP%%!'$keymap'!g' /tmp/autoinstall.json
osid=$(grep ^ID= /etc/os-release | sed -e 's/ID=//g' -e 's/"//g')
if [ "$osid" = "sles" ]; then
sed -i 's!%%PRODUCT%%!'SLES'!g' /tmp/autoinstall.json
else
sed -i 's!%%PRODUCT%%!openSUSE_Leap!g' /tmp/autoinstall.json
fi
if [ ! -e /tmp/installdisk ]; then
python3 /tmp/getinstalldisk
fi
installdisk=$(cat /tmp/installdisk)
if [ -z "$installdisk" ]; then
echo "Unable to determine target disk for installation"
sleep inf
fi
echo "Installing to $installdisk"
sed -i 's!%%INSTALLDISK%%!'/dev/$installdisk'!g' /tmp/autoinstall.json