summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorSteffen Ritter2024-01-30 14:35:18 +0100
committerSteffen Ritter2024-01-30 14:35:18 +0100
commitd21a3f0b3e2a2c5a2d8006b96c918314b57b0089 (patch)
treeefcbfb2dd85def890b1683377942ab32d192ab07 /core
parent[disk-partitions] Scan for ID83 in background; skip ro-partitions for rw-type... (diff)
downloadmltk-d21a3f0b3e2a2c5a2d8006b96c918314b57b0089.tar.gz
mltk-d21a3f0b3e2a2c5a2d8006b96c918314b57b0089.tar.xz
mltk-d21a3f0b3e2a2c5a2d8006b96c918314b57b0089.zip
[run-virt] Fix corrupted vmx with additional NICs
Don't accidentally add an empty line to TMPCONFIG. Also make awk ignore empty lines when looking for duplicates so we don't end up with an ' = ' line which will crash vmplayer. Bonuspoint: sort the output for better readability
Diffstat (limited to 'core')
-rw-r--r--core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc7
1 files changed, 4 insertions, 3 deletions
diff --git a/core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc b/core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc
index f1d83fb6..6dd226de 100644
--- a/core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc
+++ b/core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc
@@ -40,9 +40,9 @@ setup_ethernet() {
# Remove lines that could break things
sed -i "/^${eth}\.connectionType/Id;/^${eth}\.present/Id" "${TMPCONFIG}"
# Set up devType
- devline=
if ! grep -q -i "^${eth}\.virtualDev" "${TMPCONFIG}" && [ -n "$devtype" ]; then
devline="${eth}.virtualDev = "'"'"${devtype}"'"'
+ echo "${devline}" >> "${TMPCONFIG}"
fi
cat >> "${TMPCONFIG}" <<-HEND
${eth}.connectionType = "custom"
@@ -50,7 +50,6 @@ setup_ethernet() {
${eth}.vnet = "vmnet${vmnet}"
${eth}.addressType = "static"
${eth}.address = "${mac}"
- ${devline}
HEND
done
fi
@@ -336,7 +335,7 @@ write_final_vmx() {
finalize_hardware
# Killing duplicate entries; always keep last value:
- awk -F= '{
+ awk -F= 'NF{
b = $0;
gsub(/^[ \t]+|[ \t]+$/, "", $1);
gsub(/^[ \t]*[^ \t]+[ \t]*=[ \t]*|[ \t]+$/, "", b);
@@ -347,6 +346,8 @@ write_final_vmx() {
}' "${TMPCONFIG}" > "${TMPCONFIG}.tmp" \
&& mv -f "${TMPCONFIG}.tmp" "${TMPCONFIG}"
+ sort -o "${TMPCONFIG}" "${TMPCONFIG}"
+
# At last: Let's copy it to $VM_CONF_DIR/run-vmware.conf
if cp -p "${TMPCONFIG}" "${VM_RUN_FILE}"; then
writelog "Copied '${TMPCONFIG}' to '${VM_RUN_FILE}'"