+++ /dev/null
-#!/bin/sh
-
-set -ex
-
-d=$1
-
-cd /var/rsync/autobuild
-
-for BUILD in '' -high -mappingsupport; do
- rm -rf .new
- mkdir .new
- cd .new
- if ! unzip ~/Xonotic-"$d$BUILD".zip; then
- good=false
- #for f in ~/Xonotic-"$d$BUILD".zip; do
- # unzip "$f" && good=true && break
- #done
- $good
- fi
- cd Xonotic/data
- for X in *"$d"*; do
- pre=${X%$d*}
- post=${X##*$d}
- mv "$X" "$pre"rsync"$post"
- done
- cd ../../..
- rm -rf Xonotic.old
- mv Xonotic"$BUILD" Xonotic.old || true
- mv .new/Xonotic Xonotic"$BUILD"
- rmdir .new
- rm -rf Xonotic.old
-done
fi
rsync -vaSHP Xonotic*.zip Xonotic*.sha512 autobuild-release-uploader@beta.xonotic.org:"$RELEASETYPEDIR"
if [ -z "$RELEASETYPEDIR" ]; then
- ssh autobuild-release-uploader@beta.xonotic.org sh ../../update-rsync.sh "$d"
+ # Update one package at a time (to reduce temp space requirement), on all mirrors simultaneously
+ rm -rf rsynctmp && mkdir rsynctmp && cd rsynctmp
+ for suffix in '' -high -mappingsupport; do
+ package="Xonotic$suffix"
+ unzip ../Xonotic-"$d$suffix".zip
+ [ "$package" != Xonotic ] && mv Xonotic "$package"
+ while read firstword restoflineignored; do
+ mirror=${firstword%%//*}
+ [ -z $mirror ] && continue
+ # if desired an extra word could be parsed from mirrors.txt to change /var/rsync
+ # ports and usernames should be specified in .ssh/config
+ rpath=/var/rsync/autobuild
+ rsync -rtzlyhhS --delete-delay --executability --stats --link-dest="$rpath/$package" \
+ "$package/" "$mirror:$rpath/.$package.new/" \
+ && ssh "$mirror" "
+ set -e
+ cd $rpath
+ rm -rf .$package.old
+ [ -e $package ] && mv $package .$package.old
+ mv .$package.new $package
+ rm -rf .$package.old
+ " || echo "<font color=\"red\">Failed to update $package on rsync mirror $mirror</font>" | $IRCSPAM \
+ &
+ done < ../misc/tools/rsync-updater/mirrors.txt
+ wait
+ rm -rf "$package"
+ done
+ cd .. && rm -rf rsynctmp
# also upload pipeline files for .gitlab-ci.yml in xonotic-data.pk3dir
cp data/stormkeep-????????????????????????????????????????-????????????????????????????????????????.pk3 stormkeep.pk3
cd data/xonotic-maps.pk3dir # need correct path inside pk3
- 7z a -tzip -mx=9 ../../stormkeep.pk3 maps/stormkeep.mapinfo maps/stormkeep.waypoints*
- cd ~/xonotic-release-build
+ 7z a -tzip -mx=9 ../../stormkeep.pk3 maps/stormkeep.mapinfo maps/stormkeep.waypoints*
+ cd ../..
PIPELINE_FILES="gmqcc/gmqcc Xonotic/xonotic-linux64-dedicated stormkeep.pk3"
rsync -vSP $PIPELINE_FILES autobuild-release-uploader@beta.xonotic.org:../pipeline-bin/
rm -f stormkeep.pk3
release-rsync)
release_common
# make sure everything we need is installed and updated
- verbose "$d0"/misc/tools/msys2-linux.sh --schroot=sid rsync dash openssl
+ verbose "$d0"/misc/tools/msys2-linux.sh --schroot=sid rsync dash openssl sed
targetroot="$PWD/Xonotic"
verbose cd "$HOME/msys64" # see msys2-linux.sh
verbose cp --parents \
usr/bin/msys-2.0.dll \
usr/bin/msys-crypto-3.dll \
usr/bin/msys-iconv-2.dll \
+ usr/bin/msys-intl-8.dll \
usr/bin/msys-lz4-1.dll \
usr/bin/msys-ssl-3.dll \
usr/bin/msys-xxhash-0.dll \
usr/bin/msys-zstd-1.dll \
usr/bin/openssl.exe \
usr/bin/rsync.exe \
+ usr/bin/sed.exe \
usr/ssl/cert.pem \
"$targetroot/misc/tools/rsync-updater/"
# msys2 sh.exe is currently bash
--- /dev/null
+// One mirror per line, the first word is the FQDN, other parameters could be added.
+rsync.xonotic.org // location: DE, admins: Xonotic Core Team
+rsync.xonotic.au // location: AU, admins: rly and bones_was_here
fi
# openssl is the only option, as gnutls-cli is broken in rsync-ssl and stunnel doesn't verify the cert.
-rsynccmd=rsync-ssl
+rsynccmd="rsync-ssl --timeout=3"
if ! command -v openssl > /dev/null; then
if [ $interactive = false ]; then
printf >&2 "\033[1;31mFATAL: openssl not found, please install the openssl package!\033[m\n"
read -r secchoice
[ "$secchoice" = n ] || [ "$secchoice" = N ] && exit 1
done
- rsynccmd=rsync
+ rsynccmd="rsync --contimeout=3"
fi
case "${0##*/}" in
printf "\033[1;35mFound manually created 'Xonotic-high' package override\033[m\n"
package="Xonotic-high"
fi
-url="rsync.xonotic.org/$buildtype/$package"
+source="$buildtype/$package"
excludes=
if [ -n "$XONOTIC_INCLUDE_ALL" ]; then
esac
fi
+bestmirror=rsync.xonotic.org
+if [ -z "$(rsync --help | sed -En 's/(--write-devices)/\1/p')" ]; then
+ printf "\033[1;33mNOTE: your rsync version is too old for mirror autoselect and modern compression, expect bad performance. Please update to rsync 3.2.0 or later!\033[m\n"
+else
+ printf "Updating mirror list ... "
+ out=$($rsynccmd -t "rsync://$bestmirror/autobuild/Xonotic/misc/tools/rsync-updater/mirrors.txt" mirrors.txt 2>&1) \
+ && printf "\033[0;32mOK\033[m\n" \
+ || printf "\033[1;31mERROR\n\033[0;31m$out\033[m\n" | sed '2,${s/^/ /}'
+
+ bestspeed=0
+ while read firstword restoflineignored; do
+ mirror=${firstword%%//*}
+ [ -z $mirror ] && continue
+ printf "Testing mirror \033[36m$mirror\033[m ... \033[m"
+ # not the most rigorous benchmark, but fit for purpose and unaffected by local filesystem perf
+ if out=$($rsynccmd --compress-choice=none --write-devices --stats "rsync://$mirror/$source/COPYING" /dev/null 2>&1); then
+ # parse the speed from the --stats output (integer part only), and strip any commas (thousands separators)
+ speed=$(printf "$out" | sed -En 's/.* ([0-9,]+)\.?[0-9]* bytes\/sec$/\1/p' | sed 's/,//g')
+ if [ $speed -gt $bestspeed ]; then
+ bestspeed=$speed
+ bestmirror=$mirror
+ fi
+ printf "\033[0;32mOK, speed $speed\033[m\n"
+ else
+ printf "\033[1;31mERROR\n\033[0;31m$out\033[m\n" | sed '2,${s/^/ /}'
+ fi
+ done < mirrors.txt
+ if [ $bestspeed -eq 0 ]; then printf "\033[1;31mAll mirror tests failed, no internet?\033[m\n"; exit 1; fi
+fi
+
resolvedtarget=$(cd $target && [ "${PWD#$HOME}" != "$PWD" ] && printf "~${PWD#$HOME}" || printf "$PWD")
-printf "Updating \033[1;34m$resolvedtarget\033[m from \033[0;36m$url \033[m...\n"
+printf "Updating \033[1;34m$resolvedtarget\033[m from \033[0;36m$bestmirror/$source \033[m...\n"
targetname=$(cd "$target" && printf "${PWD##*/}")
if [ "$1" = "-y" ] || [ "$1" = "--yes" ]; then
done
# exec ensures this script stops before it's updated to prevent potential glitches
-exec $rsynccmd $options $excludes "rsync://$url/" "$target"
+exec $rsynccmd $options $excludes "rsync://$bestmirror/$source/" "$target"