Gamer-Server-Utility-Scripts/Rimworld-Together/one-off-mod-dl.sh

52 lines
1.5 KiB
Bash

#!/bin/bash
# Path to the SteamCMD executable
STEAMCMD_PATH="/opt/steamcmd/steamcmd.sh"
# 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/rimworld/optional-mods"
# AppID for the game (replace with the appropriate AppID)
APP_ID="294100"
#!/bin/bash
if [ -z "$1" ]; then
echo
redecho "Workshop ID needs to be \$1"
echo
exit
else
blueecho "WorkshopID is: $1"
fi
#### request php compatability section
steamWorkshopLink="$@"
# Extracting the Workshop ID using sed
workshopID=$(echo "$steamWorkshopLink" | sed 's/.*id=\([0-9]*\).*/\1/')
# Displaying the extracted Workshop ID
echo "Workshop ID: $workshopID"
# Do the DL
"$STEAMCMD_PATH" +force_install_dir "$INSTALL_DIR" +login anonymous +workshop_download_item "$APP_ID" "$workshopID" +quit
#### end request php compatability section
"$STEAMCMD_PATH" +force_install_dir "$INSTALL_DIR" +login anonymous +workshop_download_item "$APP_ID" "$1" +quit
echo "Download Complete"
# This should be handled better, i got lazy
# should have ln -s the steam DL dir instead of moving, opps
/usr/bin/rsync -av --delete /home/rimworld/optional-mods/steamapps/workshop/content/294100/* /home/rimworld/Mods/Optional/
cp -r /home/rimworld/optional-mods/steamapps/workshop/content/294100/* /home/rimworld/Mods/Optional/
/usr/bin/rm -rf /home/rimworld/optional-mods/steamapps/workshop/content/294100/*
# DL sometimes done by www because of request form
/usr/bin/chmod -R 444 /home/rimworld/Mods/Optional/