2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-11-20 01:12:25 +00:00

Fix profile installedargs on Debian, Ubuntu and SUSE

On Debian and Ubuntu 18.04 the installedargs line of profile.yaml was
added to GRUB_CMDLINE_LINUX with its "installedargs:" key still in
front, and update-grub was not run for it, so the arguments only took
effect with a later grub update, as a broken first argument.

All Debian and Ubuntu profiles also put the arguments into a sed
replacement unescaped, so an argument containing a slash, such as
rd.lvm.lv=vg/root, made sed fail and left the grub defaults unchanged.

SUSE 16 put the arguments into a JSON string unescaped, so an argument
containing a double quote or backslash produced an invalid
autoinstall.json, and one containing "!" or "&" broke the sed command
that fills it in.

SUSE 15 put them into the AutoYaST XML unescaped, so an argument
containing "&" or "<" made the whole profile invalid and stopped the
install.
This commit is contained in:
Markus Hilger
2026-11-12 05:12:30 +01:00
parent 209d6ef2ed
commit 52ae9c9e16
6 changed files with 10 additions and 2 deletions
@@ -41,9 +41,11 @@ if [ "$textcons" = "true" ] && ! grep console= /proc/cmdline > /dev/null; then
updategrub=1
fi
fi
kargs=$(python3 /opt/confluent/bin/apiclient /confluent-public/os/$confluent_profile/profile.yaml | grep ^installedargs: | sed -e 's/#.*//')
kargs=$(python3 /opt/confluent/bin/apiclient /confluent-public/os/$confluent_profile/profile.yaml | grep ^installedargs: | sed -e 's/^installedargs:[[:space:]]*//' -e 's/#.*//')
if [ ! -z "$kargs" ]; then
kargs=$(printf '%s' "$kargs" | sed -e 's/[\/&]/\\&/g')
sed -i 's/GRUB_CMDLINE_LINUX="\([^"]*\)"/GRUB_CMDLINE_LINUX="\1 '"${kargs}"'"/' /etc/default/grub
updategrub=1
fi
if [ 1 = $updategrub ]; then
@@ -229,6 +229,7 @@ append=$(grep ^installedargs: /tmp/profile.yaml | sed -e 's/^installedargs: //'
if grep console= /etc/fakecmdline >& /dev/null && [[ "$append" != *console=* ]]; then
append="$append console=${autocons#*/dev/}"
fi
append=$(printf '%s' "$append" | sed -e 's/&/\&amp;/g' -e 's/</\&lt;/g' -e 's/>/\&gt;/g')
if [ -z "$append" ]; then
echo "<bootloader/>" > /tmp/bootloader.xml
else
@@ -46,6 +46,7 @@ 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: //')
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)
@@ -41,9 +41,11 @@ if [ "$textcons" = "true" ] && ! grep console= /proc/cmdline > /dev/null; then
updategrub=1
fi
fi
kargs=$(python3 /opt/confluent/bin/apiclient /confluent-public/os/$confluent_profile/profile.yaml | grep ^installedargs: | sed -e 's/#.*//')
kargs=$(python3 /opt/confluent/bin/apiclient /confluent-public/os/$confluent_profile/profile.yaml | grep ^installedargs: | sed -e 's/^installedargs:[[:space:]]*//' -e 's/#.*//')
if [ ! -z "$kargs" ]; then
kargs=$(printf '%s' "$kargs" | sed -e 's/[\/&]/\\&/g')
sed -i 's/GRUB_CMDLINE_LINUX="\([^"]*\)"/GRUB_CMDLINE_LINUX="\1 '"${kargs}"'"/' /etc/default/grub
updategrub=1
fi
if [ 1 = $updategrub ]; then
@@ -48,6 +48,7 @@ if [ "$textcons" = "true" ] && ! grep console= /proc/cmdline > /dev/null; then
fi
kargs=$(curl https://$confluent_mgr/confluent-public/os/$confluent_profile/profile.yaml | grep ^installedargs: | sed -e 's/^installedargs:[[:space:]]*//' -e 's/#.*//')
if [ ! -z "$kargs" ]; then
kargs=$(printf '%s' "$kargs" | sed -e 's/[\/&]/\\&/g')
sed -i 's/GRUB_CMDLINE_LINUX="\([^"]*\)"/GRUB_CMDLINE_LINUX="\1 '"${kargs}"'"/' /target/etc/default/grub
updategrub=1
fi
@@ -48,6 +48,7 @@ if [ "$textcons" = "true" ] && ! grep console= /proc/cmdline > /dev/null; then
fi
kargs=$(curl https://$confluent_mgr/confluent-public/os/$confluent_profile/profile.yaml | grep ^installedargs: | sed -e 's/^installedargs:[[:space:]]*//' -e 's/#.*//')
if [ ! -z "$kargs" ]; then
kargs=$(printf '%s' "$kargs" | sed -e 's/[\/&]/\\&/g')
sed -i 's/GRUB_CMDLINE_LINUX="\([^"]*\)"/GRUB_CMDLINE_LINUX="\1 '"${kargs}"'"/' /target/etc/default/grub
updategrub=1
fi