]> ##&name; ###2026.05.11 - Tested on 7.2.6 - VMWare Tools v13.0.10 ###2025.11.06 - Tested on 7.2.0 - VMWare Tools v13.0.5 ###2025.06.24 - Tested on 7.1.4 - VMWare Tools v13.0.0 ###2025.05.14 - Tested on 7.1.2 - VMWare Tools v12.5.2 ###2025.02.28 - Tested on 7.0.1 - VMWare Tools v12.5.0 - Removed support for unRAID versions prior to 6.10.0 - New support thread: https://forums.unraid.net/topic/187519-plugin-open-vm-tools/ OVT_STATE=/tmp/ovt_install_state SOURCE=&source; UNRAID_VERSION=$(awk -F= '/^version/{gsub(/"/, "", $2); print $2}' /etc/unraid-version) KERNEL=$(uname -r) echo "" echo "==================================================" echo " openVMTools Pre-Install" echo " unRAID Version: $UNRAID_VERSION" echo " Kernel: $KERNEL" echo "==================================================" echo "" # Select the correct package for this unRAID version. # Each arm is explicit — no overlapping globs — so the first match always wins. case $UNRAID_VERSION in ## unRAID 7.x 7.0.*) OVTNAME=open_vm_tools-12.5.0-202502272018.tgz ;; 7.1.0|7.1.1|7.1.2) OVTNAME=open_vm_tools-12.5.2-202505141922.tgz ;; 7.*) # 7.1.3+ and any future 7.x release OVTNAME=open_vm_tools-13.0.10-202605111659.tgz ;; ## unRAID 6.x 6.10.0|6.10.1) OVTNAME=open_vm_tools-12.0.0-5.15.40-Unraid-x86_64-202205171643.tgz ;; 6.10.2) OVTNAME=open_vm_tools-12.0.0-5.15.43-Unraid-x86_64-202205292055.tgz ;; 6.10.3) OVTNAME=open_vm_tools-12.0.5-5.15.46-Unraid-x86_64-202206141259.tgz ;; 6.11.*) OVTNAME=open_vm_tools-12.1.0-202208241430.tgz ;; 6.12.[0-9]) OVTNAME=open_vm_tools-12.3.5-202402131823.tgz ;; 6.12.[0-9][0-9]) OVTNAME=open_vm_tools-12.4.5-202409011517.tgz ;; *) echo "ERROR: openVMTools has not been compiled for unRAID $UNRAID_VERSION." echo " For versions prior to 6.10.0 use the legacy plugin:" echo " &gitURL;/openVMTools_compiled_prior_to_v6.12.0.plg" echo " Support: &supportURL;" echo "" exit 1 ;; esac echo "Selected package: $OVTNAME" mkdir -p "$SOURCE" # ----------------------------------------------------------------------- # SHA256SUMS — download from repo so hashes stay current without a plugin # update. The SHA256SUMS file in the packages/ directory must be kept in # sync with every new open_vm_tools build that is pushed to GitHub. # ----------------------------------------------------------------------- SUMFILE="$SOURCE/SHA256SUMS" echo "Fetching SHA256SUMS for hash verification..." if wget -q --timeout=20 --no-cache --no-check-certificate \ "&repo;/SHA256SUMS" -O "$SUMFILE.tmp" 2>/dev/null; then mv "$SUMFILE.tmp" "$SUMFILE" else echo "WARNING: Could not fetch SHA256SUMS — hash verification will be skipped." rm -f "$SUMFILE.tmp" SUMFILE="" fi # ----------------------------------------------------------------------- # verify_hash PKG_PATH PKG_NAME SUMFILE # Returns 0 on pass/skipped, 1 on mismatch. # ----------------------------------------------------------------------- verify_hash() { local pkg="$1" name="$2" sumfile="$3" if [ -z "$sumfile" ] || [ ! -f "$sumfile" ]; then return 0 fi local expected actual expected=$(grep -E "(^|[[:space:]])${name}([[:space:]]|$)" "$sumfile" | awk '{print $1}') if [ -z "$expected" ]; then echo "WARNING: No entry for '$name' in SHA256SUMS — skipping verification." return 0 fi actual=$(sha256sum "$pkg" | awk '{print $1}') if [ "$actual" = "$expected" ]; then echo " SHA256 OK: $name" return 0 else echo "ERROR: SHA256 mismatch for $name" echo " Expected: $expected" echo " Got: $actual" return 1 fi } # ----------------------------------------------------------------------- # Download open_vm_tools package (with retry). Verify hash if available. # If a cached copy exists, verify it first; re-download if corrupt. # ----------------------------------------------------------------------- OVTPKG="$SOURCE/$OVTNAME" OVTURL="&repo;/$OVTNAME" if [ -f "$OVTPKG" ]; then echo "Cached package found: $OVTNAME" if ! verify_hash "$OVTPKG" "$OVTNAME" "$SUMFILE"; then echo " Cached copy is corrupt — removing and re-downloading." rm -f "$OVTPKG" fi fi if [ ! -f "$OVTPKG" ]; then echo "Downloading $OVTNAME..." DOWNLOAD_OK=false for attempt in 1 2 3; do echo " Attempt $attempt of 3..." if wget -q --timeout=30 --no-cache --no-check-certificate \ "$OVTURL" -O "$OVTPKG" 2>/dev/null; then DOWNLOAD_OK=true break fi rm -f "$OVTPKG" if [ $attempt -lt 3 ]; then sleep 4; fi done if [ "$DOWNLOAD_OK" = false ]; then echo "ERROR: Failed to download $OVTNAME after 3 attempts." exit 1 fi if ! verify_hash "$OVTPKG" "$OVTNAME" "$SUMFILE"; then rm -f "$OVTPKG" exit 1 fi fi # Pass package name to the post-install script via a state file. echo "OVTNAME=$OVTNAME" > "$OVT_STATE" # ----------------------------------------------------------------------- # libdnet — required by open-vm-tools. # Check in order: system install → local cache → GitHub repo → Slackware. # No version is hard-coded; whatever is newest wins. # ----------------------------------------------------------------------- echo "" echo "--- Checking libdnet ---" if ls /var/log/packages/libdnet* >/dev/null 2>/dev/null; then echo "libdnet already installed: $(ls /var/log/packages/libdnet* | head -1 | xargs basename)" else LIBDNET_PKG="" # 1. Local cache LIBDNET_PKG=$(ls "$SOURCE"/libdnet*.txz 2>/dev/null | sort -V | tail -1) if [ -n "$LIBDNET_PKG" ]; then echo "Using cached libdnet: $(basename $LIBDNET_PKG)" fi # 2. GitHub repo (query the API for the latest libdnet package in packages/) if [ -z "$LIBDNET_PKG" ]; then echo "Querying GitHub for libdnet..." LIBDNET_NAME=$(wget -qO- --timeout=15 --no-check-certificate \ "&gitAPI;" 2>/dev/null \ | grep -oP '"name":\s*"\Klibdnet[^"]+\.txz' \ | sort -V | tail -1) if [ -n "$LIBDNET_NAME" ]; then echo " Found on GitHub: $LIBDNET_NAME" if wget -q --timeout=30 --no-check-certificate \ "&repo;/$LIBDNET_NAME" -O "$SOURCE/$LIBDNET_NAME" 2>/dev/null; then LIBDNET_PKG="$SOURCE/$LIBDNET_NAME" else rm -f "$SOURCE/$LIBDNET_NAME" fi fi fi if [ -n "$LIBDNET_PKG" ]; then if [ -f "$LIBDNET_PKG" ]; then echo " Installing $(basename $LIBDNET_PKG)..." upgradepkg --install-new "$LIBDNET_PKG" else echo "WARNING: libdnet package file missing. open-vm-tools may fail to load." fi else echo "WARNING: libdnet could not be downloaded. open-vm-tools may fail to load." fi fi echo "" echo "Pre-install complete." OVT_STATE=/tmp/ovt_install_state SOURCE=&source; if [ ! -f "$OVT_STATE" ]; then echo "ERROR: Pre-install state file not found — cannot continue." exit 1 fi . "$OVT_STATE" rm -f "$OVT_STATE" OVTPKG="$SOURCE/$OVTNAME" if [ ! -f "$OVTPKG" ]; then echo "ERROR: Expected package not found: $OVTPKG" exit 1 fi # ----------------------------------------------------------------------- # libffi compatibility symlink. # Some open-vm-tools binaries link against libffi.so.6. Newer unRAID # ships libffi.so.8+ with no .so.6 present. We create a symlink pointing # to the highest available libffi so, regardless of version. # ----------------------------------------------------------------------- setup_libffi() { local target=/usr/lib64/libffi.so.6 # Already valid (real file or working symlink) if [ -e "$target" ]; then echo "libffi.so.6 already available — skipping." return 0 fi # Remove stale broken symlink if [ -L "$target" ]; then echo "Removing broken symlink: $target" rm -f "$target" fi # Find the highest available libffi shared library (anything except .so.6) local best best=$(ls /usr/lib64/libffi.so.* 2>/dev/null \ | grep -v 'libffi\.so\.6$' \ | sort -V | tail -1) if [ -z "$best" ]; then echo "WARNING: No libffi.so.* found in /usr/lib64 — open-vm-tools may not load." return 1 fi echo "Creating symlink: libffi.so.6 -> $(basename $best)" ln -sf "$(basename $best)" "$target" } echo "" echo "==================================================" echo " openVMTools Post-Install" echo "==================================================" echo "" echo "--- libffi compatibility ---" setup_libffi echo "" echo "--- Installing $OVTNAME ---" if ! upgradepkg --install-new "$OVTPKG"; then echo "ERROR: upgradepkg failed for $OVTPKG" exit 1 fi echo "" echo "--- Starting VMware Tools daemon ---" killall vmtoolsd 2>/dev/null || true rm -f /var/run/vmtoolsd.pid /usr/local/bin/vmtoolsd -b /var/run/vmtoolsd.pid sleep 1 VMTOOLSVERSION=$(vmware-toolbox-cmd -v 2>/dev/null || echo "unknown") VMTOOLSDPID=$(pgrep vmtoolsd 2>/dev/null || echo "not running") echo "" echo "==================================================" echo " Plugin &name; installed." echo " Plugin Version: &version;" echo " VMware Tools: $VMTOOLSVERSION" echo " vmtoolsd PID: $VMTOOLSDPID" echo "==================================================" echo "" echo "" echo "--- Stopping VMware Tools ---" VMTOOLSVERSION=$(vmware-toolbox-cmd -v 2>/dev/null || echo "unknown") echo "Version: $VMTOOLSVERSION" killall vmtoolsd 2>/dev/null || true echo "" echo "--- Removing packages ---" for pkg in &source;/open_vm_tools*.tgz; do [ -f "$pkg" ] || continue echo " Removing: $(basename $pkg)" removepkg "$pkg" 2>/dev/null || true done # Remove the libffi compatibility symlink only if we created it (i.e. it is a symlink) if [ -L /usr/lib64/libffi.so.6 ]; then echo "Removing libffi.so.6 compatibility symlink." rm -f /usr/lib64/libffi.so.6 fi rm -rf "&plugdir;" rm -rf "&source;" echo "" echo "==================================================" echo " &name; removed." echo " Version: &version;" echo "==================================================" echo ""