#!/usr/bin/env bash # builds the standalone updater scripts from the shared PowerShell logic in # update_spice.ps1. each output is a self-contained polyglot .bat: a small batch # header (with the release channel baked in) followed by the shared PowerShell # body after the marker line. # # usage: build_updaters.sh OUT_DIR # OUT_DIR directory to write the generated .bat files into set -eu if [ $# -lt 1 ]; then echo "usage: build_updaters.sh OUT_DIR" >&2 exit 1 fi SRC_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PS_BODY="${SRC_DIR}/update_spice.ps1" OUT_DIR="$1" [ -f "$PS_BODY" ] || { echo "error: $PS_BODY not found" >&2; exit 1; } MARKER='#___PS___' gen() { channel="$1"; label="$2"; out="$3" { cat <
"${OUT_DIR}/${out}" echo " generated ${OUT_DIR}/${out}" } echo "Generating updater scripts from $(basename "$PS_BODY")..." gen "" "stable (pre-releases excluded)" "update_spice.bat" gen "beta" "beta (newest, pre-releases included)" "update_spice_beta.bat"