]> git.rm.cloudns.org Git - xonotic/xonotic.git/commitdiff
rsync: reduce duplication of literals, print the update operation more clearly
authorbones_was_here <bones_was_here@xonotic.au>
Wed, 26 Feb 2025 01:50:02 +0000 (11:50 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Thu, 20 Mar 2025 19:58:38 +0000 (05:58 +1000)
Linux: clarifies the message about the update being performed
Windows: adds that message

misc/tools/rsync-updater/update-to-autobuild.bat
misc/tools/rsync-updater/update-to-autobuild.sh
misc/tools/rsync-updater/update-to-release.bat

index bfa0b492191f36aad4b057b7e91fd7bedc74d666..c1ebb47c9de58e7ee55557bf31a58eafcc9c8f8b 100644 (file)
@@ -53,27 +53,28 @@ goto xonotic
        echo FATAL: unrecognized Xonotic build. This update script cannot be used.\r
        goto end\r
 :xonoticdatahigh\r
-               set url=rsync://beta.xonotic.org/%buildtype%-Xonotic-high/\r
+               set package=Xonotic-high\r
                goto endxonoticdata\r
 :xonoticdatahighfuzzy\r
-               set url=rsync://beta.xonotic.org/%buildtype%-Xonotic-high/\r
+               set package=Xonotic-high\r
                set options=%options% -y\r
                goto endxonoticdata\r
 :xonoticdatanormal\r
-               set url=rsync://beta.xonotic.org/%buildtype%-Xonotic/\r
+               set package=Xonotic\r
                goto endxonoticdata\r
 :xonoticdatanormalfuzzy\r
-               set url=rsync://beta.xonotic.org/%buildtype%-Xonotic/\r
+               set package=Xonotic\r
                set options=%options% -y\r
                goto endxonoticdata\r
 :endxonoticdata\r
        set target=./\r
        goto endxonotic\r
 :xonotic\r
-       set url=rsync://beta.xonotic.org/%buildtype%-Xonotic/\r
+       set package=Xonotic\r
        set target=Xonotic/\r
        goto endxonotic\r
 :endxonotic\r
+set url=beta.xonotic.org/%buildtype%-%package%\r
 \r
 set excludes=\r
 if not "%XONOTIC_INCLUDE_ALL%" == "" goto endbit\r
@@ -101,7 +102,9 @@ if "%ProgramFiles(x86)%" == "" goto bit32
 :endbit\r
 \r
 for %%f in (*.exe *.dll) do copy /b %%f %TEMP%\xonotic-rsync-updater\\r
-%TEMP%\xonotic-rsync-updater\rsync %options% %excludes% %url% %target%\r
+cd %target%\r
+echo Updating %CD% from %url% ...\r
+%TEMP%\xonotic-rsync-updater\rsync %options% %excludes% rsync://%url%/ %target%\r
 %TEMP%\xonotic-rsync-updater\chmod -R a+x %target%\r
 \r
 :end\r
index b07517924554cf178cd0d448b3cc20074d6425f9..d4872f64e3cde3cc645b08d10cb374d39d0fc6b9 100755 (executable)
@@ -27,49 +27,39 @@ esac
 
 options="-Prtzil --executability --delete-after --delete-excluded --stats"
 
+package="Xonotic"
+target="../../.."
 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="../../.."
+       package="Xonotic-high"
        options="$options -y" # use fuzzy matching because file names may differ
 elif [ -d "../../../data" ]; 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/"
+               package="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/"
+               package="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
                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
+url="beta.xonotic.org/$buildtype-$package"
 
 excludes=
 if [ -z "$XONOTIC_INCLUDE_ALL" ]; then
@@ -99,4 +89,6 @@ if [ -z "$XONOTIC_INCLUDE_ALL" ]; then
        esac
 fi
 
-rsync $options $excludes "$url" "$target"
+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"
+rsync $options $excludes "rsync://$url/" "$target"
index e2c2119524c21c3d0722b1d8892c09ca39a286b3..53dcab92eb7ef88d35d116f3c9a6d2d47152d356 100644 (file)
@@ -53,27 +53,28 @@ goto xonotic
        echo FATAL: unrecognized Xonotic build. This update script cannot be used.\r
        goto end\r
 :xonoticdatahigh\r
-               set url=rsync://beta.xonotic.org/%buildtype%-Xonotic-high/\r
+               set package=Xonotic-high\r
                goto endxonoticdata\r
 :xonoticdatahighfuzzy\r
-               set url=rsync://beta.xonotic.org/%buildtype%-Xonotic-high/\r
+               set package=Xonotic-high\r
                set options=%options% -y\r
                goto endxonoticdata\r
 :xonoticdatanormal\r
-               set url=rsync://beta.xonotic.org/%buildtype%-Xonotic/\r
+               set package=Xonotic\r
                goto endxonoticdata\r
 :xonoticdatanormalfuzzy\r
-               set url=rsync://beta.xonotic.org/%buildtype%-Xonotic/\r
+               set package=Xonotic\r
                set options=%options% -y\r
                goto endxonoticdata\r
 :endxonoticdata\r
        set target=./\r
        goto endxonotic\r
 :xonotic\r
-       set url=rsync://beta.xonotic.org/%buildtype%-Xonotic/\r
+       set package=Xonotic\r
        set target=Xonotic/\r
        goto endxonotic\r
 :endxonotic\r
+set url=beta.xonotic.org/%buildtype%-%package%\r
 \r
 set excludes=\r
 if not "%XONOTIC_INCLUDE_ALL%" == "" goto endbit\r
@@ -101,7 +102,9 @@ if "%ProgramFiles(x86)%" == "" goto bit32
 :endbit\r
 \r
 for %%f in (*.exe *.dll) do copy /b %%f %TEMP%\xonotic-rsync-updater\\r
-%TEMP%\xonotic-rsync-updater\rsync %options% %excludes% %url% %target%\r
+cd %target%\r
+echo Updating %CD% from %url% ...\r
+%TEMP%\xonotic-rsync-updater\rsync %options% %excludes% rsync://%url%/ %target%\r
 %TEMP%\xonotic-rsync-updater\chmod -R a+x %target%\r
 \r
 :end\r