mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-11-19 08:52:15 +00:00
fix(template): read each partitionfile entry with its own s: prefix
linuximage.partitionfile takes a comma-separated list of layout, d: disk and c: configuration entries, any of them prefixed with s: for a script. The Ubuntu layout step chose between decoding a layout file and running a layout script by the s: prefix of the last entry in the whole list, so a layout file followed by an s:d: disk script was run as a script, and a layout script followed by a d: disk file was copied into the layout as text. The parser also kept a script flag set by an earlier entry of the same kind after a later entry replaced it. Give each kind the prefix of the entry that is used, the last one of that kind, and decode the Ubuntu layout by it.
This commit is contained in:
@@ -224,15 +224,16 @@ sub subvars {
|
||||
$filepath = $1;
|
||||
}
|
||||
|
||||
# The last entry of each kind wins, with its own s: prefix.
|
||||
if ($filepath =~ /^d:(.*)/) {
|
||||
$diskfile = $1;
|
||||
if ($scriptflag) { $diskscriptflag = 1; }
|
||||
$diskfile = $1;
|
||||
$diskscriptflag = $scriptflag;
|
||||
} elsif ($filepath =~ /^c:(.*)/) {
|
||||
$configfile = $1;
|
||||
if ($scriptflag) { $configscriptflag = 1; }
|
||||
$configfile = $1;
|
||||
$configscriptflag = $scriptflag;
|
||||
} elsif ($filepath) {
|
||||
$partitionfile = $filepath;
|
||||
if ($scriptflag) { $partscriptflag = 1; }
|
||||
$partitionfile = $filepath;
|
||||
$partscriptflag = $scriptflag;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -483,7 +484,7 @@ sub subvars {
|
||||
|
||||
# Put the base64 coded partitionfile into %pre part
|
||||
$partcontent = "cat > /tmp/partscript.enc << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
|
||||
if ($scriptflag) {
|
||||
if ($partscriptflag) {
|
||||
|
||||
# Put the code to decode preseed script and run it to generate pressed recipe file
|
||||
#$partcontent .= "python -c 'import base64; print base64.b64decode(open(\"/tmp/partscript.enc\",\"rb\").read())' >/tmp/partscript\n";
|
||||
|
||||
Reference in New Issue
Block a user