From 28dcbd7928d09fcb4ed3b10ad74a9cff47ea8863 Mon Sep 17 00:00:00 2001
From: erkin <e.altunbas@vyos.io>
Date: Tue, 9 Nov 2021 16:58:15 +0300
Subject: T3962: Check if open-vm-tools is present before attempting to write
 its config

---
 data/live-build-config/hooks/live/30-openvmtools-configs.chroot | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/data/live-build-config/hooks/live/30-openvmtools-configs.chroot b/data/live-build-config/hooks/live/30-openvmtools-configs.chroot
index e3762cc9..ed734cab 100755
--- a/data/live-build-config/hooks/live/30-openvmtools-configs.chroot
+++ b/data/live-build-config/hooks/live/30-openvmtools-configs.chroot
@@ -2,6 +2,7 @@
 
 # open-vm-tools settings
 
+import os
 import re
 
 vmtools_config = """
@@ -10,5 +11,8 @@ vmtools_config = """
 
 """
 
-with open('/etc/vmware-tools/tools.conf', 'w') as f:
-    f.write(vmtools_config)
+if os.path.isdir('/etc/vmware-tools'):
+    with open('/etc/vmware-tools/tools.conf', 'w') as f:
+        f.write(vmtools_config)
+else:
+    print('Open VM Tools not found. Skipping its configuration.')
-- 
cgit v1.2.3