Sign in Sign up
kretrod/lodestone Public
Branches
master
21 lines (20 loc) · 1.2 KB Raw
#!/bin/bash
# Rebuild, stop the client that is running, and load the new build.
#
# Each build goes in under a fresh name: the client never unmaps itself (that
# is what used to crash the game), so reusing a name would just load the old
# module again. Previous copies stay resident and inert.
#
# Paths use forward slashes throughout — Windows accepts them, and it keeps
# backslashes from being eaten by two layers of shell quoting.
set -e
cd "$(dirname "$0")"
cargo build --release --target x86_64-pc-windows-gnu "$@" 2>&1 | grep -E "^error" -A10 || true
B=target/x86_64-pc-windows-gnu/release
NAME="lodestone-client-$(date +%H%M%S).dll"

ssh win 'C:/lodestone/lodestone-inject.exe --eject' 2>&1 | tail -1
scp -q "$B/lodestone_client.dll" "win:C:/lodestone/$NAME"
scp -q "$B/lodestone-inject.exe" win:C:/lodestone/lodestone-inject-new.exe
ssh win "Move-Item -Force C:/lodestone/lodestone-inject-new.exe C:/lodestone/lodestone-inject.exe -ErrorAction SilentlyContinue; if (Test-Path C:/lodestone/client.log) { Move-Item -Force C:/lodestone/client.log C:/lodestone/client.prev.log }; C:/lodestone/lodestone-inject.exe C:/lodestone/$NAME" 2>&1 | tail -1
sleep 4
ssh win 'Get-Content C:/lodestone/client.log -ErrorAction SilentlyContinue' 2>&1 | tail -12