From 78a02f58f80defbb02767e2118f2c797ffaf6a08 Mon Sep 17 00:00:00 2001 From: "Dr. Jaska" Date: Tue, 23 May 2023 05:28:17 +0000 Subject: [PATCH] Update rsync scripts and README --- misc/tools/rsync-updater/README.txt | 29 ++++---- .../rsync-updater/update-to-autobuild.bat | 36 ++++------ .../rsync-updater/update-to-autobuild.sh | 67 +++++++++++-------- .../tools/rsync-updater/update-to-release.bat | 36 ++++------ 4 files changed, 83 insertions(+), 85 deletions(-) diff --git a/misc/tools/rsync-updater/README.txt b/misc/tools/rsync-updater/README.txt index 39d6881b..0bf88feb 100644 --- a/misc/tools/rsync-updater/README.txt +++ b/misc/tools/rsync-updater/README.txt @@ -1,19 +1,24 @@ Windows users: -Double click update-xonotic.bat and wait for the download to complete. +Double click update-to-{build}.bat and wait for the download to complete. Linux/OSX users: -Change to this directory in a terminal, then run ./update-xonotic.sh and wait +Change to this directory in a terminal, then run ./update-to-{build}.sh and wait for the download to complete. -Redoing this step at a later time will only download the changes since last -time. Note that any changes inside the Xonotic directory will be overwritten. +update-to-autobuild means updating to the latest nightly beta build of Xonotic. +update-to-stable means updating to the latest stable release build of Xonotic. + +Redoing this step at a later time will only download the changes since last time. + +Note that any changes inside the Xonotic directory will be overwritten. Do your changes in the directory that has the config.cfg file! +By default those are: +On Windows the "C:\users\%userprofile%\Saved Games\xonotic\data\" folder +On Linux or Mac the "~/.xonotic/data/" directory + -Secret trick: if you create a directory Xonotic-low in this directory before -running the updater (or later, if you rename the Xonotic directory the updater -created to Xonotic-low), this script will download the low version of Xonotic. -If you create a directory Xonotic-high in this directory before running the -updater (or later, if you rename the Xonotic directory the updater created to -Xonotic-high), it will download the HQ version! If none of the two exists, it -will download regular Xonotic. Only one version of the game can be managed by -this script. +Secret trick: if you create any file/directory named "Xonotic-high" +in this directory before running the updater, this script will +download Xonotic with uncompressed textures. Otherwise it will +download regular Xonotic. To change from Xonotic-high to regular +create any file/directory named "Xonotic" and run the script again. diff --git a/misc/tools/rsync-updater/update-to-autobuild.bat b/misc/tools/rsync-updater/update-to-autobuild.bat index 1fb8b2e2..bfa0b492 100755 --- a/misc/tools/rsync-updater/update-to-autobuild.bat +++ b/misc/tools/rsync-updater/update-to-autobuild.bat @@ -18,24 +18,27 @@ if "%~n0" == "update-to-autobuild" set buildtype=autobuild set options=-Prtzil --executability --delete-after --delete-excluded --stats -if exist Xonotic-low goto xonoticlow -if exist Xonotic-high goto xonotichigh if exist ..\..\..\.git goto xonoticdatagit +if exist Xonotic goto xonoticswitchtonormal +if exist Xonotic-high goto xonoticswitchtohigh if exist ..\..\..\data goto xonoticdata goto xonotic -:xonoticlow - echo NOTE: Xonotic-low is gone, downloading normal Xonotic. - set url=rsync://beta.xonotic.org/%buildtype%-Xonotic/ - set target=Xonotic-low/ - goto endxonotic -:xonotichigh - set url=rsync://beta.xonotic.org/%buildtype%-Xonotic-high/ - set target=Xonotic-high/ - goto endxonotic :xonoticdatagit echo NOTE: this is a git repository download. Using the regular update method. ..\..\..\all update goto end +:xonoticswitchtohigh + set PATH=misc\tools\rsync-updater;%PATH% + cd ..\..\.. + if exist misc\tools\rsync-updater\rsync.exe goto xonoticdatahighfuzzy + echo FATAL: rsync not in misc\tools\rsync-updater. This update script cannot be used. + goto end +:xonoticswitchtonormal + set PATH=misc\tools\rsync-updater;%PATH% + cd ..\..\.. + if exist misc\tools\rsync-updater\rsync.exe goto xonoticdatanormalfuzzy + echo FATAL: rsync not in misc\tools\rsync-updater. This update script cannot be used. + goto end :xonoticdata if exist ..\..\..\misc\tools\rsync-updater\rsync.exe goto xonoticdatarsync echo FATAL: rsync not in misc\tools\rsync-updater. This update script cannot be used. @@ -43,23 +46,12 @@ goto xonotic :xonoticdatarsync set PATH=misc\tools\rsync-updater;%PATH% cd ..\..\.. - if exist data\xonotic-rsync-data-low.pk3 goto xonoticdatalow - if exist data\xonotic-*-data-low.pk3 goto xonoticdatalowfuzzy if exist data\xonotic-rsync-data-high.pk3 goto xonoticdatahigh if exist data\xonotic-*-data-high.pk3 goto xonoticdatahighfuzzy if exist data\xonotic-rsync-data.pk3 goto xonoticdatanormal if exist data\xonotic-*-data.pk3 goto xonoticdatanormalfuzzy echo FATAL: unrecognized Xonotic build. This update script cannot be used. goto end -:xonoticdatalow - echo NOTE: Xonotic-low is gone, downloading normal Xonotic. - set url=rsync://beta.xonotic.org/%buildtype%-Xonotic/ - goto endxonoticdata -:xonoticdatalowfuzzy - echo NOTE: Xonotic-low is gone, downloading normal Xonotic. - set url=rsync://beta.xonotic.org/%buildtype%-Xonotic/ - set options=%options% -y - goto endxonoticdata :xonoticdatahigh set url=rsync://beta.xonotic.org/%buildtype%-Xonotic-high/ goto endxonoticdata diff --git a/misc/tools/rsync-updater/update-to-autobuild.sh b/misc/tools/rsync-updater/update-to-autobuild.sh index 32ce1f2a..b0751792 100755 --- a/misc/tools/rsync-updater/update-to-autobuild.sh +++ b/misc/tools/rsync-updater/update-to-autobuild.sh @@ -1,17 +1,18 @@ #!/bin/sh -if [ -d "${0%/*}" ]; then - cd "${0%/*}" -fi +cd "${0%/*}" || exit 1 -if ! which rsync >/dev/null; then +if ! which rsync > /dev/null; then echo >&2 "FATAL: rsync not found, please install the rsync package" exit 1 fi -[ "$1" = "-y" ] && choice=y +if [ "$1" = "-y" ] || [ "$1" = "--yes" ]; then + choice=y +fi until [ "$choice" = y ] || [ "$choice" = Y ]; do - read -rp "This script will DELETE any custom files in the Xonotic folder. Do you want to continue [Y/N]? " choice + printf "This script will DELETE any custom files in the Xonotic folder. Do you want to continue [Y/N]? " + read -r choice [ "$choice" = n ] || [ "$choice" = N ] && exit 1 done @@ -26,32 +27,38 @@ esac options="-Prtzil --executability --delete-after --delete-excluded --stats" -if [ -d "Xonotic-low" ]; then - echo NOTE: Xonotic-low is gone, downloading normal Xonotic. - url="rsync://beta.xonotic.org/$buildtype-Xonotic/" - target="Xonotic-low/" -elif [ -d "Xonotic-high" ]; then - url="rsync://beta.xonotic.org/$buildtype-Xonotic-high/" - target="Xonotic-high/" -elif [ -d "../../../.git" ]; then +if [ -d "../../../.git" ]; then echo >&2 "NOTE: this is a git repository download. Using the regular update method." exec ../../../all update +elif [ -e "Xonotic" ]; then + echo "found manually created 'Xonotic' file" + echo "targetting the normal $buildtype version" + url="rsync://beta.xonotic.org/$buildtype-Xonotic/" + target="../../.." + options="$options -y" # use fuzzy matching because file names may differ +elif [ -e "Xonotic-high" ]; then + echo "found manually created 'Xonotic-high' file" + echo "targetting the high $buildtype version" + url="rsync://beta.xonotic.org/$buildtype-Xonotic-high/" + target="../../.." + options="$options -y" # use fuzzy matching because file names may differ elif [ -d "../../../data" ]; then - if [ -f ../../../data/xonotic-rsync-data-low.pk3 ]; then - echo NOTE: Xonotic-low is gone, downloading normal Xonotic. - url="rsync://beta.xonotic.org/$buildtype-Xonotic/" - elif [ -f ../../../data/xonotic-*-data-low.pk3 ]; then - echo NOTE: Xonotic-low is gone, downloading normal Xonotic. - url="rsync://beta.xonotic.org/$buildtype-Xonotic/" - options="$options -y" # use fuzzy matching because file names differ - elif [ -f ../../../data/xonotic-rsync-data-high.pk3 ]; then + if [ -f ../../../data/xonotic-rsync-data-high.pk3 ]; then + echo "found rsync high data files" + echo "targetting the high $buildtype version" url="rsync://beta.xonotic.org/$buildtype-Xonotic-high/" elif [ -f ../../../data/xonotic-*-data-high.pk3 ]; then + echo "found release high data files" + echo "targetting the high $buildtype version" url="rsync://beta.xonotic.org/$buildtype-Xonotic-high/" options="$options -y" # use fuzzy matching because file names differ elif [ -f ../../../data/xonotic-rsync-data.pk3 ]; then + echo "found Xonotic rsync data files" + echo "targetting the normal $buildtype version" url="rsync://beta.xonotic.org/$buildtype-Xonotic/" elif [ -f ../../../data/xonotic-*-data.pk3 ]; then + echo "found Xonotic release data files" + echo "targetting the normal $buildtype version" url="rsync://beta.xonotic.org/$buildtype-Xonotic/" options="$options -y" # use fuzzy matching because file names differ else @@ -67,25 +74,27 @@ fi excludes= if [ -z "$XONOTIC_INCLUDE_ALL" ]; then excludes="$excludes --exclude=/*.exe" - excludes="$excludes --exclude=/gmqcc/*.exe" excludes="$excludes --exclude=/bin32" excludes="$excludes --exclude=/*.dll" excludes="$excludes --exclude=/bin64" - case `uname`:`uname -m` in + case $(uname):$(uname -m) in Darwin:*) excludes="$excludes --exclude=/xonotic-linux*" - excludes="$excludes --exclude=/gmqcc/gmqcc.linux*" ;; Linux:x86_64) excludes="$excludes --exclude=/Xonotic*.app" excludes="$excludes --exclude=/xonotic-osx-*" - excludes="$excludes --exclude=/gmqcc/gmqcc.osx" - excludes="$excludes --exclude=/xonotic-linux32-*" - excludes="$excludes --exclude=/gmqcc/gmqcc.linux32" ;; *) - echo >&2 "WARNING: Could not detect architecture - downloading all architectures" + printf >&2 "\e[1;31m" + printf >&2 "WARNING: Could not detect architecture\n" + printf >&2 "WARNING: Xonotic does NOT provide pre-built %s executables\n" "$(uname):$(uname -m)" + printf >&2 "WARNING: Please run make. More info is available at\n" + printf >&2 "WARNING: \e[1;36mhttps://gitlab.com/xonotic/xonotic/-/wikis/Compiling\e[m\n" + excludes="$excludes --exclude=/Xonotic*.app" + excludes="$excludes --exclude=/xonotic-osx-*" + excludes="$excludes --exclude=/xonotic-linux64-*" ;; esac fi diff --git a/misc/tools/rsync-updater/update-to-release.bat b/misc/tools/rsync-updater/update-to-release.bat index 10126a6a..e2c21195 100755 --- a/misc/tools/rsync-updater/update-to-release.bat +++ b/misc/tools/rsync-updater/update-to-release.bat @@ -18,24 +18,27 @@ if "%~n0" == "update-to-autobuild" set buildtype=autobuild set options=-Prtzil --executability --delete-after --delete-excluded --stats -if exist Xonotic-low goto xonoticlow -if exist Xonotic-high goto xonotichigh if exist ..\..\..\.git goto xonoticdatagit if exist ..\..\..\data goto xonoticdata +if exist Xonotic goto xonoticswitchtonormal +if exist Xonotic-high goto xonoticswitchtohigh goto xonotic -:xonoticlow - echo NOTE: Xonotic-low is gone, downloading normal Xonotic. - set url=rsync://beta.xonotic.org/%buildtype%-Xonotic/ - set target=Xonotic-low/ - goto endxonotic -:xonotichigh - set url=rsync://beta.xonotic.org/%buildtype%-Xonotic-high/ - set target=Xonotic-high/ - goto endxonotic :xonoticdatagit echo NOTE: this is a git repository download. Using the regular update method. ..\..\..\all update goto end +:xonoticswitchtohigh + set PATH=misc\tools\rsync-updater;%PATH% + cd ..\..\.. + if exist misc\tools\rsync-updater\rsync.exe goto xonoticdatahighfuzzy + echo FATAL: rsync not in misc\tools\rsync-updater. This update script cannot be used. + goto end +:xonoticswitchtonormal + set PATH=misc\tools\rsync-updater;%PATH% + cd ..\..\.. + if exist misc\tools\rsync-updater\rsync.exe goto xonoticdatanormalfuzzy + echo FATAL: rsync not in misc\tools\rsync-updater. This update script cannot be used. + goto end :xonoticdata if exist ..\..\..\misc\tools\rsync-updater\rsync.exe goto xonoticdatarsync echo FATAL: rsync not in misc\tools\rsync-updater. This update script cannot be used. @@ -43,23 +46,12 @@ goto xonotic :xonoticdatarsync set PATH=misc\tools\rsync-updater;%PATH% cd ..\..\.. - if exist data\xonotic-rsync-data-low.pk3 goto xonoticdatalow - if exist data\xonotic-*-data-low.pk3 goto xonoticdatalowfuzzy if exist data\xonotic-rsync-data-high.pk3 goto xonoticdatahigh if exist data\xonotic-*-data-high.pk3 goto xonoticdatahighfuzzy if exist data\xonotic-rsync-data.pk3 goto xonoticdatanormal if exist data\xonotic-*-data.pk3 goto xonoticdatanormalfuzzy echo FATAL: unrecognized Xonotic build. This update script cannot be used. goto end -:xonoticdatalow - echo NOTE: Xonotic-low is gone, downloading normal Xonotic. - set url=rsync://beta.xonotic.org/%buildtype%-Xonotic/ - goto endxonoticdata -:xonoticdatalowfuzzy - echo NOTE: Xonotic-low is gone, downloading normal Xonotic. - set url=rsync://beta.xonotic.org/%buildtype%-Xonotic/ - set options=%options% -y - goto endxonoticdata :xonoticdatahigh set url=rsync://beta.xonotic.org/%buildtype%-Xonotic-high/ goto endxonoticdata -- 2.39.2