62 lines
1.5 KiB
Bash
62 lines
1.5 KiB
Bash
|
#!/bin/bash
|
||
|
|
||
|
set -e
|
||
|
|
||
|
ARMA_MOD_VOLUME="arma3_dev_mods"
|
||
|
|
||
|
# Check if argument is given
|
||
|
if [ -z "$1" ]; then
|
||
|
echo "No argument given. Use workshop id as argument. e.g. 1400118996"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
|
||
|
PAYLOAD=$(cat <<EOF
|
||
|
set -e
|
||
|
|
||
|
WORKSHOP_DIR="/home/steam/Steam/steamapps/workshop/content"
|
||
|
|
||
|
mkdir -p \$WORKSHOP_DIR
|
||
|
rm -rf \$WORKSHOP_DIR/content
|
||
|
ln -s /home/steam/mount "\$WORKSHOP_DIR/107410"
|
||
|
|
||
|
echo -n "Username: "
|
||
|
read username
|
||
|
|
||
|
echo "Perform initial login. Exit after successfull login. To login type login username"
|
||
|
|
||
|
/home/steam/steamcmd/steamcmd.sh +login \$username +quit
|
||
|
|
||
|
tmpFile=$(mktemp)
|
||
|
|
||
|
for mod_id in \$(curl -s "https://steamcommunity.com/sharedfiles/filedetails/?id=$1" | grep -E 'id="sharedfile_[0-9]+"' | sed 's/.*id="sharedfile_\([0-9]\+\)".*/\1/')
|
||
|
do
|
||
|
{
|
||
|
echo "// autogenerated DONT TOUCH";
|
||
|
echo -e "@ShutdownOnFailedCommand 1";
|
||
|
echo -e "@NoPromptForPassword 1"
|
||
|
echo "login \$username";
|
||
|
echo "workshop_download_item 107410 \$mod_id validate";
|
||
|
echo "quit";
|
||
|
} > "\$tmpFile"
|
||
|
|
||
|
echo "Downloading mod \$mod_id"
|
||
|
|
||
|
until /home/steam/steamcmd/steamcmd.sh +runscript "\$tmpFile"; do echo -e "###\nLets try that again\n###"; done
|
||
|
|
||
|
echo -e "###\nDownload finished\n###"
|
||
|
done
|
||
|
|
||
|
# for f in \$(find /home/steam/mount -type f -name '*.pbo' -o -type f -name '*.bisign'); do mv -v "\$f" "\$(echo \$f | tr '[A-Z]' '[a-z]')"; done
|
||
|
|
||
|
EOF
|
||
|
)
|
||
|
|
||
|
docker run \
|
||
|
-it \
|
||
|
--rm \
|
||
|
--name=arma3_mods \
|
||
|
-v "$ARMA_MOD_VOLUME":/home/steam/mount \
|
||
|
cm2network/steamcmd \
|
||
|
bash -c "$PAYLOAD"
|