summaryrefslogtreecommitdiffstats
path: root/core/modules/vmware16/data/addon-required
blob: a84bb7ffa0abbbc645f4b9bbf6d947b3df59441c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash

version=$( "$NEWROOT/opt/openslx/bin/vmware-get-supported-version" )

# Calling directly failed, try to chroot to $NEWROOT and call again

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.

	declare -a bindmount=( "/dev" "/proc" "/sys" )
	declare -a bound=()
	echo "Direct version check failed, trying chroot..."

	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" ]