Skip to content

Commit

Permalink
Merge pull request #92 from Aterfax/patch-DCSSB-autoupdate
Browse files Browse the repository at this point in the history
Update DCSSB long run to auto update Python packages
  • Loading branch information
Aterfax authored Dec 11, 2024
2 parents 1f052d6 + 0bfd40b commit 1d32bc5
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion docker/src/s6-services/s6-init-dcssb-auto-start-longrun/run
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,25 @@ if [ "${DCSSBAUTOSTART}" != "1" ]; then
exit 0
fi

# Define the path to the DCSSB virtual environment
VENV_PATH="/config/.wine/drive_c/users/abc/.dcssb"

# Check if the directory exists to indicate if the manual first install has happened
if [ ! -d "$VENV_PATH" ]; then
echo "DCSSBAUTOSTART set to auto start but no Python virtual environment appears to exist."
echo "Please ensure you have manually installed DCSServerBot prior to auto starting."
sleep ${TIMEOUT}
exit 1
fi

# What lies below is cursed.
# First update the venv packages as the DCSSB update.py won't do so due to logic that won't trigger
sudo -E -u abc bash <<EOF
wine cmd.exe /c "%USERPROFILE%\.dcssb\Scripts\python.exe -m pip install -r %USERPROFILE%\DCSServerBot\requirements.txt"
EOF

# Now start up the bot
sudo -E -u abc bash <<'EOF'
export DISPLAY=:1.0 # Set the display to the main X server display
xfce4-terminal --title=DCSServerbot --default-working-directory=/config/.wine/drive_c/users/abc/DCSServerBot -e 'wine /config/.wine/drive_c/users/abc/DCSServerBot/run.cmd'
EOF
EOF

0 comments on commit 1d32bc5

Please sign in to comment.