#!/usr/bin/env bash # About me: Installs the built extension into the Vortex Wine prefix and repairs # the prefix's missing Steam libraryfolders.vdf. Vortex loads user extensions from # AppData/Roaming/Vortex/plugins inside the prefix, so installing is a copy plus # a restart of Vortex. # # Usage: tools/install-extension.sh [--prefix ] [--force-shim] [--disable-bundled] set -euo pipefail PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" PREFIX="${VORTEX_PREFIX:-$HOME/.config/steamtinkerlaunch/vortex/compatdata/pfx}" EXTENSION_NAME="game-cyberpunk2077-linux" FORCE_SHIM="" DISABLE_BUNDLED="no" while [[ $# -gt 0 ]]; do case "$1" in --prefix) PREFIX="$2"; shift 2 ;; --force-shim) FORCE_SHIM="--force"; shift ;; --disable-bundled) DISABLE_BUNDLED="yes"; shift ;; *) echo "unknown argument: $1" >&2; exit 1 ;; esac done if [[ ! -d "$PREFIX" ]]; then echo "prefix not found: $PREFIX" >&2 exit 1 fi PLUGINS_DIR="$PREFIX/drive_c/users/steamuser/AppData/Roaming/Vortex/plugins" if [[ ! -d "$PLUGINS_DIR" ]]; then echo "Vortex plugins directory not found: $PLUGINS_DIR" >&2 echo "start Vortex once in this prefix, then run this script again" >&2 exit 1 fi echo "==> building" (cd "$PROJECT_ROOT" && npm run --silent build) TARGET="$PLUGINS_DIR/$EXTENSION_NAME" echo "==> installing to $TARGET" rm -rf "$TARGET" mkdir -p "$TARGET" cp "$PROJECT_ROOT/dist/index.js" "$PROJECT_ROOT/dist/info.json" "$PROJECT_ROOT/dist/package.json" "$TARGET/" cp "$PROJECT_ROOT/dist/gameart.png" "$TARGET/" echo "==> repairing the prefix's Steam libraryfolders.vdf" (cd "$PROJECT_ROOT" && node --experimental-strip-types scripts/repair-prefix.mjs --prefix "$PREFIX" ${FORCE_SHIM:+$FORCE_SHIM}) if [[ "$DISABLE_BUNDLED" == "yes" ]]; then BUNDLED="$PREFIX/drive_c/Program Files/Black Tree Gaming Ltd/Vortex/resources/app.asar.unpacked/bundledPlugins/game-cyberpunk2077" if [[ -d "$BUNDLED" ]]; then echo "==> disabling the bundled Cyberpunk stub: $BUNDLED -> $BUNDLED.disabled" mv "$BUNDLED" "$BUNDLED.disabled" else echo "==> bundled Cyberpunk stub not present, nothing to disable" fi fi echo "==> done. Restart Vortex, then manage 'Cyberpunk 2077 (Linux/Proton)'."