summaryrefslogtreecommitdiffstats
path: root/core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc
diff options
context:
space:
mode:
authorSimon Rettberg2023-03-15 16:26:04 +0100
committerSimon Rettberg2023-03-15 16:26:04 +0100
commit36c29b9547060a91f519d65de7ade2a34332c0f4 (patch)
tree8279e3cd7f362c3c48bce618340f2c7b51536235 /core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc
parent[debug-report-bwlp] Add --message option for non-interactive use (diff)
downloadmltk-36c29b9547060a91f519d65de7ade2a34332c0f4.tar.gz
mltk-36c29b9547060a91f519d65de7ade2a34332c0f4.tar.xz
mltk-36c29b9547060a91f519d65de7ade2a34332c0f4.zip
[vmware-common] Filter .vmx; if keys appear multiple times, keep last one
Diffstat (limited to 'core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc')
-rw-r--r--core/modules/vmware-common/data/opt/openslx/vmchooser/plugins/vmware/includes/write_final_vmx.inc13
1 files changed, 11 insertions, 2 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 6a1b0a34..d45247c3 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
@@ -335,8 +335,17 @@ write_final_vmx() {
[[ " $SLX_REMOTE_VNC " == *" vmware "* ]] && setup_vnc
finalize_hardware
- # Killing duplicate lines (output much nicer than sort -u):
- awk '!a[$0]++' "${TMPCONFIG}" > "${TMPCONFIG}.tmp" && mv -f "${TMPCONFIG}.tmp" "${TMPCONFIG}"
+ # Killing duplicate entries; always keep last value:
+ awk -F= '{
+ b = $0;
+ gsub(/^[ \t]+|[ \t]+$/, "", $1);
+ gsub(/^[ \t]*[^ \t]+[ \t]*=[ \t]*|[ \t]+$/, "", b);
+ a[$1] = b;
+ }
+ END {
+ for (k in a) printf "%s = %s\n", k, a[k];
+ }' "${TMPCONFIG}" > "${TMPCONFIG}.tmp" \
+ && mv -f "${TMPCONFIG}.tmp" "${TMPCONFIG}"
# At last: Let's copy it to $VM_CONF_DIR/run-vmware.conf
if cp -p "${TMPCONFIG}" "${VM_RUN_FILE}"; then