From b36ae2b8060940cd2db595a9fcc71b6651d6e65d Mon Sep 17 00:00:00 2001 From: Jonas8272 Date: Sun, 22 Nov 2026 18:37:45 +0000 Subject: [PATCH] vmware-workstation-pro: add autoupdate workflow (every 6 hours) The script picks the newest build in the archive.org item, downloads it, checks size/md5 and the Broadcom signature, then pins the SHA-256. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01XFn3QekarqiDEYnrbupCyz --- .../autoupdate-vmware-workstation-pro.yml | 28 +++++++ scripts/update-vmware-workstation-pro.sh | 73 +++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 .forgejo/workflows/autoupdate-vmware-workstation-pro.yml create mode 100644 scripts/update-vmware-workstation-pro.sh diff --git a/.forgejo/workflows/autoupdate-vmware-workstation-pro.yml b/.forgejo/workflows/autoupdate-vmware-workstation-pro.yml new file mode 100644 index 0000000..a22f4a9 --- /dev/null +++ b/.forgejo/workflows/autoupdate-vmware-workstation-pro.yml @@ -0,0 +1,28 @@ +name: autoupdate-vmware-workstation-pro +on: + schedule: + - cron: '17 */6 * * *' + workflow_dispatch: + +jobs: + update: + runs-on: ubuntu-latest + container: + image: data.forgejo.org/oci/node:20-bookworm + steps: + - name: Install tools + run: apt-get update -qq && apt-get install -y -qq jq curl ca-certificates osslsigncode + + - uses: actions/checkout@v4 + + - name: Update manifest + run: tr -d '\r' < scripts/update-vmware-workstation-pro.sh | bash + + - name: Commit and push + run: | + git config user.name "autoupdate" + git config user.email "autoupdate@users.noreply.codefloe.com" + if ! git diff --quiet; then + git commit -am "vmware-workstation-pro: update to $(jq -r .version bucket/vmware-workstation-pro.json)" + git push + fi diff --git a/scripts/update-vmware-workstation-pro.sh b/scripts/update-vmware-workstation-pro.sh new file mode 100644 index 0000000..0a1c490 --- /dev/null +++ b/scripts/update-vmware-workstation-pro.sh @@ -0,0 +1,73 @@ +#!/usr/bin/env bash +set -euo pipefail + +M=bucket/vmware-workstation-pro.json +ITEM=vmwareworkstationarchive +META="https://archive.org/metadata/$ITEM/files" + +files=$(curl -fsSL --retry 3 --connect-timeout 30 "$META") + +# Newest Windows installer = highest build number among files like +# 26H1/VMware-Workstation-Full-26H1u1-25688693.exe (the old 17.x and older +# builds use a different name and are ignored). +latest=$(jq -c ' + [ (if type == "array" then . else (.result // .files) end)[] + | select(.name | test("^[0-9]{2}H[0-9]/VMware-Workstation-Full-[0-9]{2}H[0-9](u[0-9]+)?-[0-9]+\\.exe$")) + | . + { build: (.name | capture("-(?[0-9]+)\\.exe$").b | tonumber), + ver: (.name | capture("Full-(?[0-9]{2}H[0-9](u[0-9]+)?)-").v) } ] + | sort_by(.build) | last // empty' <<<"$files") + +[ -n "$latest" ] || { echo "no VMware Workstation installer found in $ITEM" >&2; exit 1; } + +name=$(jq -r .name <<<"$latest") +ver=$(jq -r .ver <<<"$latest") +build=$(jq -r .build <<<"$latest") +size=$(jq -r .size <<<"$latest") +md5=$(jq -r .md5 <<<"$latest") + +url="https://archive.org/download/$ITEM/$name#/setup.exe" +cur_url=$(jq -r .url "$M") + +if [ "$url" = "$cur_url" ]; then + echo "up to date ($(jq -r .version "$M"))" + exit 0 +fi + +cur_build=$(sed -E 's/.*-([0-9]+)\.exe.*/\1/' <<<"$cur_url") +if [[ $cur_build =~ ^[0-9]+$ ]] && [ "$build" -le "$cur_build" ]; then + echo "archive newest build ($build) is not newer than the manifest ($cur_build), leaving it alone" + exit 0 +fi + +echo "new build $build ($ver), downloading to verify it" +tmp=$(mktemp -d) +trap 'rm -rf "$tmp"' EXIT +exe="$tmp/setup.exe" +curl -fSL --retry 3 --retry-delay 15 --connect-timeout 30 -o "$exe" "https://archive.org/download/$ITEM/$name" + +# 1. It is a Windows executable of the size and md5 archive.org lists (transfer check). +[ "$(head -c2 "$exe")" = "MZ" ] || { echo "download is not an exe" >&2; exit 1; } +[ "$(stat -c%s "$exe")" = "$size" ] || { echo "size mismatch" >&2; exit 1; } +[ "$(md5sum "$exe" | cut -d' ' -f1)" = "$md5" ] || { echo "md5 mismatch" >&2; exit 1; } + +# 2. It carries a valid digital signature from Broadcom (authenticity check). +# archive.org is a third-party upload, so this is what protects the bucket. +if ! osslsigncode verify -in "$exe" \ + -CAfile /etc/ssl/certs/ca-certificates.crt \ + -TSA-CAfile /etc/ssl/certs/ca-certificates.crt >"$tmp/sig.txt" 2>&1; then + cat "$tmp/sig.txt" >&2 + echo "signature verification failed, not updating" >&2 + exit 1 +fi +grep -q 'Broadcom Inc' "$tmp/sig.txt" || { cat "$tmp/sig.txt" >&2; echo "installer is not signed by Broadcom Inc, not updating" >&2; exit 1; } + +hash=$(sha256sum "$exe" | cut -d' ' -f1) + +cur=$(jq -r .version "$M") +jq --indent 4 --arg v "$ver" --arg u "$url" --arg h "$hash" --arg b "$build" \ + '.version=$v + | .description = "VMware Workstation Pro, build \($b) (downloaded from the vmwareworkstationarchive item on archive.org)" + | .url=$u | .hash=$h' \ + "$M" > "$M.tmp" && mv "$M.tmp" "$M" + +echo "updated $cur -> $ver (build $build)"