From 99b767d89f60a499e86e8e55b4f8c0905472a7ca Mon Sep 17 00:00:00 2001 From: Extacy Date: Thu, 12 Mar 2020 04:26:05 +0000 Subject: [PATCH] Use TangoFTP instead of steam collection kzmaps.tangoworldwide.net is kept up to date by the KZ global team Maps can become unavailable to download or play if steam is experiencing any issues For a server operator there's hardly any benefits from using the workshop --- Dockerfile | 4 ---- entrypoint.sh | 34 ++++++++++++----------------- mapsync.sh | 59 --------------------------------------------------- mapsynckzt.sh | 59 --------------------------------------------------- 4 files changed, 13 insertions(+), 143 deletions(-) delete mode 100644 mapsync.sh delete mode 100644 mapsynckzt.sh diff --git a/Dockerfile b/Dockerfile index b6b38c8..6ee46c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -58,15 +58,11 @@ RUN wget -q https://raw.githubusercontent.com/nikooo777/ckSurf/master/csgo/addon WORKDIR /home/csgo COPY databases.cfg /home/csgo/plugins/addons/sourcemod/configs/ -COPY mapsync.sh /home/csgo/ -COPY mapsynckzt.sh /home/csgo/ COPY entrypoint.sh /home/csgo/ USER root RUN chmod +x /home/csgo/entrypoint.sh -RUN chmod +x /home/csgo/mapsync.sh -RUN chmod +x /home/csgo/mapsynckzt.sh USER csgo diff --git a/entrypoint.sh b/entrypoint.sh index 6ac2870..af5689c 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -58,20 +58,6 @@ installKZTimer() { echo '> Done' } -#downloadMaps() { -# echo "> Downloading maps ..." -# cd /home/csgo/server/csgo/maps/workshop -# /bin/bash /home/csgo/mapsync.sh -# cd /home/csgo/server/csgo -#} - -#downloadMapsKZT() { -# echo "> Downloading maps ..." -# cd /home/csgo/server/csgo/maps/workshop -# /bin/bash /home/csgo/mapsynckzt.sh -# cd /home/csgo/server/csgo -#} - installServer() { echo '> Installing server ...' @@ -176,13 +162,19 @@ else installGOKZ fi -#if [ "$DLMAPS" == "yes" ]; then -# if [ "$TIMER" == "kztimer" ]; then -# downloadMapsKZT -# else -# downloadMaps -# fi -#fi +if [ "$DLMAPS" == "yes" ]; then + echo '> Downloading Maps ... (this may take a while)' + if [ "$TIMER" == "kztimer" ]; then + maplist=$(curl -s https://kzmaps.tangoworldwide.net/mapcycles/kztimer.txt) + else + maplist=$(curl -s https://kzmaps.tangoworldwide.net/mapcycles/gokz.txt) + fi + + for i in $maplist; do + wget -q -P $CSGO_DIR/maps https://kzmaps.tangoworldwide.net/bsps/$i.bsp + done + echo -e '\n> Done' +fi if [ "$MAPCHOOSER" == "yes" ]; then mv $CSGO_DIR/addons/sourcemod/plugins/disabled/mapchooser.smx $CSGO_DIR/addons/sourcemod/plugins/ diff --git a/mapsync.sh b/mapsync.sh deleted file mode 100644 index 663b535..0000000 --- a/mapsync.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash - -collections=(1942732975 1942753106 1942767730 1942784132 1942796140 1942813106) - -# Loop over collections and grab each map's ID -ids=() -for id in ${collections[@]}; do - collection=$(curl --silent -H "Content-Type: application/x-www-form-urlencoded" \ - -d "collectioncount=1" \ - -d "publishedfileids[0]=$id" \ - https://api.steampowered.com/ISteamRemoteStorage/GetCollectionDetails/v1/) - - keys=$( echo "$collection" | jq -r ".response | .collectiondetails[0] | .children | keys | .[]") - - for key in $keys; do - item=$( echo "$collection" | jq -r ".response | .collectiondetails[0] | .children | nth($key) | .publishedfileid") - ids+=($item) - done -done - -# Grab a list of maps that are on the server -maps=() -for dir in $(find -type d); do - map=$( echo $dir | sed -e "s%./%%") - - if [[ $map =~ [[:digit:]]{3,} ]]; then - maps+=($map) - fi -done - -# Loop over workshop items, comparing versions and downloading if needed. -# Subtract from maps=() and then loop over what's remaining and remove that. -for id in ${ids[@]}; do - response=$(curl --silent -H "Content-Type: application/x-www-form-urlencoded" \ - -d "itemcount=1" \ - -d "publishedfileids[0]=$id" \ - https://api.steampowered.com/ISteamRemoteStorage/GetPublishedFileDetails/v1/) - - name=$( echo $response | jq -r ".response | .publishedfiledetails[0] | .filename" | sed -e "s%mymaps/%%") - size=$( echo $response | jq -r ".response | .publishedfiledetails[0] | .file_size") - url=$( echo $response | jq -r ".response | .publishedfiledetails[0] | .file_url") - - if [ ! -d "$id" ] || [ ! -f "$id/$name" ]; then - # Does not exist, download. - mkdir -p $id - wget -q --show-progress $url -O $id/$name - else - # Exists, compare size & download if differ - if [ $size != $(stat --printf="%s" $id/$name) ]; then - wget -q --show-progress $url -O $id/$name - fi - fi - maps=(${maps[@]/$id}) -done - -# Maps that are downloaded, but don't exist in the collection anymore. -for map in ${maps[@]}; do - rm -r $map -done \ No newline at end of file diff --git a/mapsynckzt.sh b/mapsynckzt.sh deleted file mode 100644 index a553141..0000000 --- a/mapsynckzt.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash - -collections=(1942732975 1942753106 1942767730 1942784132 1942796140) - -# Loop over collections and grab each map's ID -ids=() -for id in ${collections[@]}; do - collection=$(curl --silent -H "Content-Type: application/x-www-form-urlencoded" \ - -d "collectioncount=1" \ - -d "publishedfileids[0]=$id" \ - https://api.steampowered.com/ISteamRemoteStorage/GetCollectionDetails/v1/) - - keys=$( echo "$collection" | jq -r ".response | .collectiondetails[0] | .children | keys | .[]") - - for key in $keys; do - item=$( echo "$collection" | jq -r ".response | .collectiondetails[0] | .children | nth($key) | .publishedfileid") - ids+=($item) - done -done - -# Grab a list of maps that are on the server -maps=() -for dir in $(find -type d); do - map=$( echo $dir | sed -e "s%./%%") - - if [[ $map =~ [[:digit:]]{3,} ]]; then - maps+=($map) - fi -done - -# Loop over workshop items, comparing versions and downloading if needed. -# Subtract from maps=() and then loop over what's remaining and remove that. -for id in ${ids[@]}; do - response=$(curl --silent -H "Content-Type: application/x-www-form-urlencoded" \ - -d "itemcount=1" \ - -d "publishedfileids[0]=$id" \ - https://api.steampowered.com/ISteamRemoteStorage/GetPublishedFileDetails/v1/) - - name=$( echo $response | jq -r ".response | .publishedfiledetails[0] | .filename" | sed -e "s%mymaps/%%") - size=$( echo $response | jq -r ".response | .publishedfiledetails[0] | .file_size") - url=$( echo $response | jq -r ".response | .publishedfiledetails[0] | .file_url") - - if [ ! -d "$id" ] || [ ! -f "$id/$name" ]; then - # Does not exist, download. - mkdir -p $id - wget -q --show-progress $url -O $id/$name - else - # Exists, compare size & download if differ - if [ $size != $(stat --printf="%s" $id/$name) ]; then - wget -q --show-progress $url -O $id/$name - fi - fi - maps=(${maps[@]/$id}) -done - -# Maps that are downloaded, but don't exist in the collection anymore. -for map in ${maps[@]}; do - rm -r $map -done \ No newline at end of file