-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
run_zwift.sh
executable file
·41 lines (31 loc) · 1.02 KB
/
run_zwift.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
set -e
set -x
ZWIFT_HOME="$HOME/.wine/drive_c/Program Files (x86)/Zwift"
if [ ! -d "$ZWIFT_HOME" ]; then
echo "Directory $ZWIFT_HOME does not exist. Has Zwift been installed?"
exit 1
fi
cd "$ZWIFT_HOME"
echo "starting zwift..."
wine start ZwiftLauncher.exe SilentLaunch
LAUNCHER_PID_HEX=$(winedbg --command "info proc" | grep -P "ZwiftLauncher.exe" | grep -oP "^\s\K.+?(?=\s)")
LAUNCHER_PID=$((16#$LAUNCHER_PID_HEX))
if [[ ! -z "$ZWIFT_USERNAME" ]] && [[ ! -z "$ZWIFT_PASSWORD" ]];
then
echo "authenticating with zwift..."
wine start /exec /bin/runfromprocess-rs.exe $LAUNCHER_PID ZwiftApp.exe --token=$(zwift-auth)
else
wine start /exec /bin/runfromprocess-rs.exe $LAUNCHER_PID ZwiftApp.exe
fi
sleep 3
until pgrep -f ZwiftApp.exe &> /dev/null
do
echo "Waiting for zwift to start ..."
sleep 1
done
echo "Killing uneccesary applications"
pkill ZwiftLauncher
pkill ZwiftWindowsCra
pkill -f MicrosoftEdgeUpdate
[ -z "$ZWIFT_NO_GAMEMODE" ] && /usr/games/gamemoderun wineserver -w || wineserver -w