summaryrefslogtreecommitdiffstats
path: root/core/modules/vmware15/data/addon-required
diff options
context:
space:
mode:
Diffstat (limited to 'core/modules/vmware15/data/addon-required')
-rw-r--r--core/modules/vmware15/data/addon-required35
1 files changed, 24 insertions, 11 deletions
diff --git a/core/modules/vmware15/data/addon-required b/core/modules/vmware15/data/addon-required
index a86e41bc..a84bb7ff 100644
--- a/core/modules/vmware15/data/addon-required
+++ b/core/modules/vmware15/data/addon-required
@@ -1,19 +1,32 @@
#!/bin/bash
-# the vmware helper needs the kmod msr and the tool rdmsr,
-# /dev, /sys and /proc to properly detect the CPU info.
+version=$( "$NEWROOT/opt/openslx/bin/vmware-get-supported-version" )
-bindmount=("/dev" "/proc" "/sys")
+# Calling directly failed, try to chroot to $NEWROOT and call again
-for bm in "${bindmount[@]}"; do
- mount --bind "$bm" "${NEWROOT}/${bm}"
-done
+if [ -z "$version" ] || [ "$version" = "fail" ]; then
+ # the vmware helper needs the kmod msr and the tool rdmsr,
+ # /dev, /sys and /proc to properly detect the CPU info.
-export PATH="$PATH:/opt/openslx/sbin:/opt/openslx/bin"
-version="$(chroot "$NEWROOT" vmware-get-supported-version)"
+ declare -a bindmount=( "/dev" "/proc" "/sys" )
+ declare -a bound=()
+ echo "Direct version check failed, trying chroot..."
-for bm in "${bindmount[@]}"; do
- umount "${NEWROOT}/${bm}"
-done
+ cleanup() {
+ for bm in "${bound[@]}"; do
+ umount "${NEWROOT}/${bm}"
+ done
+ }
+ trap cleanup EXIT
+
+ for bm in "${bindmount[@]}"; do
+ mount --bind "$bm" "${NEWROOT}/${bm}" || exit 1
+ bound+=( "$bm" )
+ done
+
+ export PATH="$PATH:/opt/openslx/sbin:/opt/openslx/bin"
+ version="$( chroot "$NEWROOT" vmware-get-supported-version )"
+
+fi
[ -n "$version" ] && [ "$version" = "new" ]