summaryrefslogtreecommitdiffstats
path: root/core/modules/vmware17
diff options
context:
space:
mode:
authorSimon Rettberg2024-02-16 16:08:23 +0100
committerSimon Rettberg2024-02-16 16:08:23 +0100
commite8fa85304cc9f69fee09fa67c7b61e75cf8ba580 (patch)
treee4e52b03931bf331b9e126a23d7a25cd93944d38 /core/modules/vmware17
parent[remote-access] Disable xfce's compositing (diff)
downloadmltk-e8fa85304cc9f69fee09fa67c7b61e75cf8ba580.tar.gz
mltk-e8fa85304cc9f69fee09fa67c7b61e75cf8ba580.tar.xz
mltk-e8fa85304cc9f69fee09fa67c7b61e75cf8ba580.zip
[vmware.*] Try to avoid chroot in addon-required check script
Diffstat (limited to 'core/modules/vmware17')
-rw-r--r--core/modules/vmware17/data/addon-required35
1 files changed, 24 insertions, 11 deletions
diff --git a/core/modules/vmware17/data/addon-required b/core/modules/vmware17/data/addon-required
index a86e41bc..a84bb7ff 100644
--- a/core/modules/vmware17/data/addon-required
+++ b/core/modules/vmware17/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" ]