Add ModDownloader.sh

This commit is contained in:
Clarth 2023-12-13 22:33:53 -05:00
parent 953a3ddb0b
commit 80f7ca6803
1 changed files with 56 additions and 0 deletions

56
ModDownloader.sh Normal file
View File

@ -0,0 +1,56 @@
#!/bin/bash
# Path to the SteamCMD executable
STEAMCMD_PATH="/home/steam/.steam/steamcmd.sh"
# SteamCMD login details (replace with your own)
STEAM_USERNAME="user"
STEAM_PASSWORD="password"
# Path to the text file containing workshop IDs (one ID per line)
WORKSHOP_IDS_FILE="/path/to/workshop_ids.txt"
# Path to the directory where you want to install the workshop items
#mods will be in $INSTALL_DIR/steamapps/workshop/content/$APP_ID/$workshop_id/
INSTALL_DIR="/home/steam/.steam/"
# AppID for the game (replace with the appropriate AppID)
APP_ID="730" # 730 is the AppID for Counter-Strike: Global Offensive
# Ensure the SteamCMD executable exists
if [ ! -f "$STEAMCMD_PATH" ]; then
echo "Error: SteamCMD not found at $STEAMCMD_PATH. Please provide the correct path."
exit 1
fi
# Loop through each workshop ID in the file
while IFS= read -r workshop_id || [ -n "$workshop_id" ]; do
# Run SteamCMD to install the workshop item
# Uncomment for user login
#"$STEAMCMD_PATH" +force_install_dir "$INSTALL_DIR" +login "$STEAM_USERNAME" "$STEAM_PASSWORD" +workshop_download_item "$APP_ID" "$workshop_id" +quit
#Anon login
"$STEAMCMD_PATH" +force_install_dir "$INSTALL_DIR" +login anonymous +workshop_download_item "$APP_ID" "$workshop_id" +quit
# Move the downloaded item to the desired installation directory
# Don't do this, link to the mod dir with ln -s instead'
# It's easier to keep mods updated this way'
# mv -f "$INSTALL_DIR/steamapps/workshop/content/$APP_ID/$workshop_id/" "$INSTALL_DIR"
echo
echo
echo
echo "Installed workshop item with ID $workshop_id"
echo
#Rate Limit fix
sleep 5
done < "$WORKSHOP_IDS_FILE"
echo "Installation complete."
exit