mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-10-20 14:45:41 +00:00
fix(xcat-core): a diskfull install runs a post script bash cannot parse
Every diskfull install stopped in the installer. The node installed the OS and
answered ping, but no postscript ran, so remoteshell never wrote the root key
and the management node got "Permission denied (publickey,password)". The node
stayed at status powering-on and reinstalled in a loop.
append_xcatpost_cleanup in xCAT/postscripts/xcatdsklspost writes the cleanup
with a here-document whose delimiter is EOF, so the file holds a line "EOF".
post.xcat, post.xcat.ng, post.xcat.rhels10, post.debian and the two s390x
scripts embed the whole file with "#INCLUDE:<path>#" inside "cat
>/opt/xcat/xcatdsklspost << 'EOF'". That line ends the outer here-document
early, and the remaining 890 lines of xcatdsklspost become shell code in the
generated install script. bash reports a syntax error and curtin fails the
late-command that runs it.
The here-document now ends at XCATPOST_CLEANUP, and a comment states the
constraint the file is under.
postscript_heredoc_embedding.t assembles each embedding and parses it. It fails
on the six install scripts without this change.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
(cherry picked from commit b2d19b4afe)
This commit is contained in:
committed by
github-actions[bot]
parent
a06ba8e46d
commit
181050ea43
@@ -255,14 +255,17 @@ append_xcatpost_cleanup()
|
||||
|
||||
cleanupdiskfullxcatpost=`grep CLEANUPDISKFULLXCATPOST= "$mypostscript" |awk -F = '{print $2}' | tr -d \'\" | tr A-Z a-z`
|
||||
if [[ "$cleanupdiskfullxcatpost" =~ ^(1|yes|y)$ ]]; then
|
||||
cat >> "$mypostscript" <<EOF
|
||||
# post.xcat and the other install scripts embed this whole file in a here-document
|
||||
# that ends at a line "EOF". A line "EOF" here ends that here-document early and
|
||||
# leaves the rest of this file as shell code in the generated install script.
|
||||
cat >> "$mypostscript" <<XCATPOST_CLEANUP
|
||||
if [ "\$return_value" -eq "0" ]; then
|
||||
cd /
|
||||
find $postdir/ -type f -not -name 'updateflag.awk' -delete
|
||||
find $postdir/ -type d -empty -delete
|
||||
msgutil_r \$MASTER_IP "info" "cleanup of $postdir completed.(\$NODE)" "/var/log/xcat/xcat.log" "\$log_label"
|
||||
fi
|
||||
EOF
|
||||
XCATPOST_CLEANUP
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user