73 lines
1.6 KiB
Bash
Executable File
73 lines
1.6 KiB
Bash
Executable File
#!/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"
|
|
MOD_DIR="\$WORKSHOP_DIR/107410"
|
|
|
|
mkdir -p \$WORKSHOP_DIR
|
|
ln -s /home/steam/mount "\$MOD_DIR"
|
|
|
|
echo -n "Username: "
|
|
read username
|
|
|
|
echo "Perform initial login."
|
|
|
|
/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 "### DOWNLOAD FINISHED ###"
|
|
done
|
|
|
|
echo "### FIX CASE ###"
|
|
|
|
IFS=\$'\n'
|
|
for SRC in \$(find "\$MOD_DIR/" -depth)
|
|
do
|
|
DST=\$(dirname "\${SRC}")/\$(basename "\${SRC}" | tr '\[A-Z\]' '\[a-z\]')
|
|
if [ "\${SRC}" != "\${DST}" ]
|
|
then
|
|
[ ! -e "\${DST}" ] && mv -vT "\${SRC}" "\${DST}"
|
|
fi
|
|
done
|
|
|
|
|
|
EOF
|
|
)
|
|
|
|
docker run \
|
|
-it \
|
|
--rm \
|
|
--name=arma3_mods \
|
|
-v "$ARMA_MOD_VOLUME":/home/steam/mount \
|
|
cm2network/steamcmd \
|
|
bash -c "$PAYLOAD"
|