X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=misc%2Ftools%2Frsync-updater%2Fupdate-to-autobuild.sh;h=b07517924554cf178cd0d448b3cc20074d6425f9;hb=HEAD;hp=b0d429dd2d6fd5c3bd20ba89936ea0e0076cf098;hpb=9b7ad47ecb344eb39c653b91d6a4582cac243bf4;p=xonotic%2Fxonotic.git diff --git a/misc/tools/rsync-updater/update-to-autobuild.sh b/misc/tools/rsync-updater/update-to-autobuild.sh index b0d429dd..b0751792 100755 --- a/misc/tools/rsync-updater/update-to-autobuild.sh +++ b/misc/tools/rsync-updater/update-to-autobuild.sh @@ -1,14 +1,21 @@ #!/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 +if [ "$1" = "-y" ] || [ "$1" = "--yes" ]; then + choice=y +fi +until [ "$choice" = y ] || [ "$choice" = Y ]; do + 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 + case "${0##*/}" in update-to-autobuild.sh) buildtype=autobuild @@ -20,29 +27,38 @@ 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 +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 - 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 + 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 @@ -58,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