From fb923e850f64019382a256e3f7ba6345bac6d507 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Fri, 17 Feb 2012 11:30:03 +0100 Subject: [PATCH] autobuild updater: make it possible to pick between autobuild and release by separate bat file names --- ...te-xonotic.bat => update-to-autobuild.bat} | 24 ++-- ...date-xonotic.sh => update-to-autobuild.sh} | 27 +++-- .../tools/rsync-updater/update-to-release.bat | 113 ++++++++++++++++++ misc/tools/rsync-updater/update-to-release.sh | 93 ++++++++++++++ 4 files changed, 238 insertions(+), 19 deletions(-) rename misc/tools/rsync-updater/{update-xonotic.bat => update-to-autobuild.bat} (80%) rename misc/tools/rsync-updater/{update-xonotic.sh => update-to-autobuild.sh} (79%) create mode 100644 misc/tools/rsync-updater/update-to-release.bat create mode 100755 misc/tools/rsync-updater/update-to-release.sh diff --git a/misc/tools/rsync-updater/update-xonotic.bat b/misc/tools/rsync-updater/update-to-autobuild.bat similarity index 80% rename from misc/tools/rsync-updater/update-xonotic.bat rename to misc/tools/rsync-updater/update-to-autobuild.bat index 71aaee95..2e2a323e 100644 --- a/misc/tools/rsync-updater/update-xonotic.bat +++ b/misc/tools/rsync-updater/update-to-autobuild.bat @@ -5,10 +5,14 @@ cd %~dp0 rmdir /s /q %TEMP%\xonotic-rsync-updater mkdir %TEMP%\xonotic-rsync-updater for %%f in (*.exe *.dll *.bat) do copy /b %%f %TEMP%\xonotic-rsync-updater\ -%TEMP%\xonotic-rsync-updater\update-xonotic did-copy +%TEMP%\xonotic-rsync-updater\%~n0 did-copy exit :copied + +set buildtype=release +if "%~n0" == "update-to-autobuild" set buildtype=autobuild + set options=-Prtzil --executability --delete-after --delete-excluded --stats if exist Xonotic-low goto xonoticlow @@ -17,11 +21,11 @@ if exist ..\..\..\.git goto xonoticdatagit if exist ..\..\..\data goto xonoticdata goto xonotic :xonoticlow - set url=rsync://beta.xonotic.org/autobuild-Xonotic-low/ + set url=rsync://beta.xonotic.org/%buildtype%-Xonotic-low/ set target=Xonotic-low/ goto endxonotic :xonotichigh - set url=rsync://beta.xonotic.org/autobuild-Xonotic-high/ + set url=rsync://beta.xonotic.org/%buildtype%-Xonotic-high/ set target=Xonotic-high/ goto endxonotic :xonoticdatagit @@ -44,31 +48,31 @@ goto xonotic echo FATAL: unrecognized Xonotic build. This update script cannot be used. goto end :xonoticdatalow - set url=rsync://beta.xonotic.org/autobuild-Xonotic-low/ + set url=rsync://beta.xonotic.org/%buildtype%-Xonotic-low/ goto endxonoticdata :xonoticdatalowfuzzy - set url=rsync://beta.xonotic.org/autobuild-Xonotic-low/ + set url=rsync://beta.xonotic.org/%buildtype%-Xonotic-low/ set options=%options% -y goto endxonoticdata :xonoticdatahigh - set url=rsync://beta.xonotic.org/autobuild-Xonotic-high/ + set url=rsync://beta.xonotic.org/%buildtype%-Xonotic-high/ goto endxonoticdata :xonoticdatahighfuzzy - set url=rsync://beta.xonotic.org/autobuild-Xonotic-high/ + set url=rsync://beta.xonotic.org/%buildtype%-Xonotic-high/ set options=%options% -y goto endxonoticdata :xonoticdatanormal - set url=rsync://beta.xonotic.org/autobuild-Xonotic/ + set url=rsync://beta.xonotic.org/%buildtype%-Xonotic/ goto endxonoticdata :xonoticdatanormalfuzzy - set url=rsync://beta.xonotic.org/autobuild-Xonotic/ + set url=rsync://beta.xonotic.org/%buildtype%-Xonotic/ set options=%options% -y goto endxonoticdata :endxonoticdata set target=./ goto endxonotic :xonotic - set url=rsync://beta.xonotic.org/autobuild-Xonotic/ + set url=rsync://beta.xonotic.org/%buildtype%-Xonotic/ set target=Xonotic/ goto endxonotic :endxonotic diff --git a/misc/tools/rsync-updater/update-xonotic.sh b/misc/tools/rsync-updater/update-to-autobuild.sh similarity index 79% rename from misc/tools/rsync-updater/update-xonotic.sh rename to misc/tools/rsync-updater/update-to-autobuild.sh index c0b9398a..1ebefb56 100755 --- a/misc/tools/rsync-updater/update-xonotic.sh +++ b/misc/tools/rsync-updater/update-to-autobuild.sh @@ -9,32 +9,41 @@ if ! which rsync >/dev/null; then exit 1 fi +case "${0##*/}" in + update-to-autobuild.sh) + buildtype=autobuild + ;; + *) + buildtype=release + ;; +esac + options="-Prtzil --executability --delete-after --delete-excluded --stats" if [ -d "Xonotic-low" ]; then - url="rsync://beta.xonotic.org/autobuild-Xonotic-low/" + url="rsync://beta.xonotic.org/$buildtype-Xonotic-low/" target="Xonotic-low/" elif [ -d "Xonotic-high" ]; then - url="rsync://beta.xonotic.org/autobuild-Xonotic-high/" + url="rsync://beta.xonotic.org/$buildtype-Xonotic-high/" target="Xonotic-high/" elif [ -d "../../../.git" ]; then echo >&2 "NOTE: this is a git repository download. Using the regular update method." exec ../../../all update elif [ -d "../../../data" ]; then if [ -f ../../../data/xonotic-rsync-data-low.pk3 ]; then - url="rsync://beta.xonotic.org/autobuild-Xonotic-low/" + url="rsync://beta.xonotic.org/$buildtype-Xonotic-low/" elif [ -f ../../../data/xonotic-*-data-low.pk3 ]; then - url="rsync://beta.xonotic.org/autobuild-Xonotic-low/" + url="rsync://beta.xonotic.org/$buildtype-Xonotic-low/" options="$options -y" # use fuzzy matching because file names differ elif [ -f ../../../data/xonotic-rsync-data-high.pk3 ]; then - url="rsync://beta.xonotic.org/autobuild-Xonotic-high/" + url="rsync://beta.xonotic.org/$buildtype-Xonotic-high/" elif [ -f ../../../data/xonotic-*-data-high.pk3 ]; then - url="rsync://beta.xonotic.org/autobuild-Xonotic-high/" + 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 - url="rsync://beta.xonotic.org/autobuild-Xonotic/" + url="rsync://beta.xonotic.org/$buildtype-Xonotic/" elif [ -f ../../../data/xonotic-*-data.pk3 ]; then - url="rsync://beta.xonotic.org/autobuild-Xonotic/" + url="rsync://beta.xonotic.org/$buildtype-Xonotic/" options="$options -y" # use fuzzy matching because file names differ else echo >&2 "FATAL: unrecognized Xonotic build. This update script cannot be used." @@ -42,7 +51,7 @@ elif [ -d "../../../data" ]; then fi target="../../.." else - url="rsync://beta.xonotic.org/autobuild-Xonotic/" + url="rsync://beta.xonotic.org/$buildtype-Xonotic/" target="Xonotic/" fi diff --git a/misc/tools/rsync-updater/update-to-release.bat b/misc/tools/rsync-updater/update-to-release.bat new file mode 100644 index 00000000..2e2a323e --- /dev/null +++ b/misc/tools/rsync-updater/update-to-release.bat @@ -0,0 +1,113 @@ +@echo off + +if "%1" == "did-copy" goto copied +cd %~dp0 +rmdir /s /q %TEMP%\xonotic-rsync-updater +mkdir %TEMP%\xonotic-rsync-updater +for %%f in (*.exe *.dll *.bat) do copy /b %%f %TEMP%\xonotic-rsync-updater\ +%TEMP%\xonotic-rsync-updater\%~n0 did-copy +exit + +:copied + +set buildtype=release +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 +goto xonotic +:xonoticlow + set url=rsync://beta.xonotic.org/%buildtype%-Xonotic-low/ + 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 +: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. + goto end +: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 + set url=rsync://beta.xonotic.org/%buildtype%-Xonotic-low/ + goto endxonoticdata +:xonoticdatalowfuzzy + set url=rsync://beta.xonotic.org/%buildtype%-Xonotic-low/ + set options=%options% -y + goto endxonoticdata +:xonoticdatahigh + set url=rsync://beta.xonotic.org/%buildtype%-Xonotic-high/ + goto endxonoticdata +:xonoticdatahighfuzzy + set url=rsync://beta.xonotic.org/%buildtype%-Xonotic-high/ + set options=%options% -y + goto endxonoticdata +:xonoticdatanormal + set url=rsync://beta.xonotic.org/%buildtype%-Xonotic/ + goto endxonoticdata +:xonoticdatanormalfuzzy + set url=rsync://beta.xonotic.org/%buildtype%-Xonotic/ + set options=%options% -y + goto endxonoticdata +:endxonoticdata + set target=./ + goto endxonotic +:xonotic + set url=rsync://beta.xonotic.org/%buildtype%-Xonotic/ + set target=Xonotic/ + goto endxonotic +:endxonotic + +set excludes= +if not "%XONOTIC_INCLUDE_ALL%" == "" goto endbit +set excludes=%excludes% --exclude=/xonotic-linux* +set excludes=%excludes% --exclude=/xonotic-osx-* +set excludes=%excludes% --exclude=/Xonotic*.app +set excludes=%excludes% --exclude=/fteqcc/fteqcc.linux* +set excludes=%excludes% --exclude=/fteqcc/fteqcc.osx + +if "%ProgramFiles(x86)%" == "" goto bit32 +:bit64 + if not "%XONOTIC_INCLUDE_32BIT%" == "" goto endbit + set excludes=%excludes% --exclude=/xonotic.exe + set excludes=%excludes% --exclude=/xonotic-sdl.exe + set excludes=%excludes% --exclude=/xonotic-dedicated.exe + set excludes=%excludes% --exclude=/fteqcc/fteqcc.exe + set excludes=%excludes% --exclude=/bin32 + set excludes=%excludes% --exclude=/*.dll + goto endbit +:bit32 + set excludes=%excludes% --exclude=/xonotic-x64.exe + set excludes=%excludes% --exclude=/xonotic-x64-sdl.exe + set excludes=%excludes% --exclude=/xonotic-x64-dedicated.exe + set excludes=%excludes% --exclude=/fteqcc/fteqcc-x64.exe + set excludes=%excludes% --exclude=/bin64 + goto endbit +:endbit + +for %%f in (*.exe *.dll) do copy /b %%f %TEMP%\xonotic-rsync-updater\ +%TEMP%\xonotic-rsync-updater\rsync %options% %excludes% %url% %target% +%TEMP%\xonotic-rsync-updater\chmod -R a+x %target% + +:end +pause +rmdir /s /q %TEMP%\xonotic-rsync-updater diff --git a/misc/tools/rsync-updater/update-to-release.sh b/misc/tools/rsync-updater/update-to-release.sh new file mode 100755 index 00000000..1ebefb56 --- /dev/null +++ b/misc/tools/rsync-updater/update-to-release.sh @@ -0,0 +1,93 @@ +#!/bin/sh + +if [ -d "${0%/*}" ]; then + cd "${0%/*}" +fi + +if ! which rsync >/dev/null; then + echo >&2 "FATAL: rsync not found, please install the rsync package" + exit 1 +fi + +case "${0##*/}" in + update-to-autobuild.sh) + buildtype=autobuild + ;; + *) + buildtype=release + ;; +esac + +options="-Prtzil --executability --delete-after --delete-excluded --stats" + +if [ -d "Xonotic-low" ]; then + url="rsync://beta.xonotic.org/$buildtype-Xonotic-low/" + target="Xonotic-low/" +elif [ -d "Xonotic-high" ]; then + url="rsync://beta.xonotic.org/$buildtype-Xonotic-high/" + target="Xonotic-high/" +elif [ -d "../../../.git" ]; then + echo >&2 "NOTE: this is a git repository download. Using the regular update method." + exec ../../../all update +elif [ -d "../../../data" ]; then + if [ -f ../../../data/xonotic-rsync-data-low.pk3 ]; then + url="rsync://beta.xonotic.org/$buildtype-Xonotic-low/" + elif [ -f ../../../data/xonotic-*-data-low.pk3 ]; then + url="rsync://beta.xonotic.org/$buildtype-Xonotic-low/" + options="$options -y" # use fuzzy matching because file names differ + elif [ -f ../../../data/xonotic-rsync-data-high.pk3 ]; then + url="rsync://beta.xonotic.org/$buildtype-Xonotic-high/" + elif [ -f ../../../data/xonotic-*-data-high.pk3 ]; then + 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 + url="rsync://beta.xonotic.org/$buildtype-Xonotic/" + elif [ -f ../../../data/xonotic-*-data.pk3 ]; then + url="rsync://beta.xonotic.org/$buildtype-Xonotic/" + options="$options -y" # use fuzzy matching because file names differ + else + echo >&2 "FATAL: unrecognized Xonotic build. This update script cannot be used." + exit 1 + fi + target="../../.." +else + url="rsync://beta.xonotic.org/$buildtype-Xonotic/" + target="Xonotic/" +fi + +excludes= +if [ -z "$XONOTIC_INCLUDE_ALL" ]; then + excludes="$excludes --exclude=/*.exe" + excludes="$excludes --exclude=/fteqcc/*.exe" + excludes="$excludes --exclude=/bin32" + excludes="$excludes --exclude=/*.dll" + excludes="$excludes --exclude=/bin64" + + case `uname`:`uname -m` in + Darwin:*) + excludes="$excludes --exclude=/xonotic-linux*" + excludes="$excludes --exclude=/fteqcc/fteqcc.linux*" + ;; + Linux:x86_64) + excludes="$excludes --exclude=/Xonotic*.app" + excludes="$excludes --exclude=/xonotic-osx-*" + excludes="$excludes --exclude=/fteqcc/fteqcc.osx" + if [ -z "$XONOTIC_INCLUDE_32BIT" ]; then + excludes="$excludes --exclude=/xonotic-linux32-*" + excludes="$excludes --exclude=/fteqcc/fteqcc.linux32" + fi + ;; + Linux:i?86) + excludes="$excludes --exclude=/Xonotic*.app" + excludes="$excludes --exclude=/xonotic-osx-*" + excludes="$excludes --exclude=/fteqcc/fteqcc.osx" + excludes="$excludes --exclude=/xonotic-linux64-*" + excludes="$excludes --exclude=/fteqcc/fteqcc.linux64" + ;; + *) + echo >&2 "WARNING: Could not detect architecture - downloading all architectures" + ;; + esac +fi + +rsync $options $excludes "$url" "$target" -- 2.39.2