BlueGit

ict rusty-teams

Files

rusty-teams / scripts / deploy-windows.sh

deploy-windows.sh

deploy-windows.sh 1.4 KiB Download Raw
1#!/usr/bin/env bash
2# Publish the release exe to %LOCALAPPDATA%\Programs\ms-teams-linux\update\. The running app swaps itself.
3# Usage: scripts/deploy-windows.sh [exe, default the teams.exe scripts/build-windows.sh wrote]
4set -euo pipefail
5targetDirectory="${CARGO_TARGET_DIR:-${XDG_CACHE_HOME:-$HOME/.cache}/rusty-teams/target}"
6sourceExe="$(realpath "${1:-$targetDirectory/x86_64-pc-windows-msvc/release/teams.exe}")"
7installRoot="${TEAMS_INSTALL_DIR:-}"
8if [ -z "$installRoot" ]; then
9 localAppData="$(PATH="$PATH:/mnt/c/Windows/System32" cmd.exe /c 'echo %LOCALAPPDATA%' 2>/dev/null | tr -d '\r')"
10 installRoot="$(wslpath "$localAppData")/Programs/ms-teams-linux"
11fi
12version="$(grep -aoE 'teams-build:[0-9a-f]+-[0-9]{8}T[0-9]{6}Z' "$sourceExe" | head -n1 | cut -d: -f2)"
13[ -n "$version" ] || { echo "no build version found in $sourceExe" >&2; exit 1; }
14
15updateDirectory="$installRoot/update"
16mkdir -p "$updateDirectory"
17cp "$sourceExe" "$updateDirectory/teams.exe.partial"
18mv -f "$updateDirectory/teams.exe.partial" "$updateDirectory/teams.exe"
19sourcePdb="${sourceExe%.exe}.pdb"
20if [ -f "$sourcePdb" ]; then
21 cp "$sourcePdb" "$updateDirectory/teams.pdb.partial"
22 mv -f "$updateDirectory/teams.pdb.partial" "$updateDirectory/teams.pdb"
23fi
24printf '%s\n' "$version" > "$updateDirectory/version.txt.partial"
25mv -f "$updateDirectory/version.txt.partial" "$updateDirectory/version.txt"
26echo "deployed $version to $updateDirectory"