]> git.xonotic.org Git - xonotic/xonotic.git/blob - misc/tools/rsync-updater/update-xonotic.sh
env variable XONOTIC_INCLUDE_ALL to download ALL builds, not just your platform ...
[xonotic/xonotic.git] / misc / tools / rsync-updater / update-xonotic.sh
1 #!/bin/sh
2
3 if [ -d "${0%/*}" ]; then
4         cd "${0%/*}"
5 fi
6
7 if ! which rsync >/dev/null; then
8         echo >&2 "FATAL: rsync not found, please install the rsync package"
9         exit 1
10 fi
11
12 options="-Prtzil --executability --delete-after --delete-excluded --stats"
13
14 if [ -d "Xonotic-low" ]; then
15         url="rsync://beta.xonotic.org/autobuild-Xonotic-low/"
16         target="Xonotic-low/"
17 elif [ -d "Xonotic-high" ]; then
18         url="rsync://beta.xonotic.org/autobuild-Xonotic-high/"
19         target="Xonotic-high/"
20 elif [ -d "../../../.git" ]; then
21         echo >&2 "NOTE: this is a git repository download. Using the regular update method."
22         exec ../../../all update
23 elif [ -d "../../../data" ]; then
24         if [ -f ../../../data/xonotic-rsync-data-low.pk3 ]; then
25                 url="rsync://beta.xonotic.org/autobuild-Xonotic-low/"
26         elif [ -f ../../../data/xonotic-*-data-low.pk3 ]; then
27                 url="rsync://beta.xonotic.org/autobuild-Xonotic-low/"
28                 options="$options -y" # use fuzzy matching because file names differ
29         elif [ -f ../../../data/xonotic-rsync-data-high.pk3 ]; then
30                 url="rsync://beta.xonotic.org/autobuild-Xonotic-high/"
31         elif [ -f ../../../data/xonotic-*-data-high.pk3 ]; then
32                 url="rsync://beta.xonotic.org/autobuild-Xonotic-high/"
33                 options="$options -y" # use fuzzy matching because file names differ
34         elif [ -f ../../../data/xonotic-rsync-data.pk3 ]; then
35                 url="rsync://beta.xonotic.org/autobuild-Xonotic/"
36         elif [ -f ../../../data/xonotic-*-data.pk3 ]; then
37                 url="rsync://beta.xonotic.org/autobuild-Xonotic/"
38                 options="$options -y" # use fuzzy matching because file names differ
39         else
40                 echo >&2 "FATAL: unrecognized Xonotic build. This update script cannot be used."
41                 exit 1
42         fi
43         target="../../.."
44 else
45         url="rsync://beta.xonotic.org/autobuild-Xonotic/"
46         target="Xonotic/"
47 fi
48
49 excludes=
50 if [ -z "$XONOTIC_INCLUDE_ALL" ]; then
51         excludes="$excludes --exclude=/*.exe"
52         excludes="$excludes --exclude=/fteqcc/*.exe"
53         excludes="$excludes --exclude=/bin32"
54         excludes="$excludes --exclude=/*.dll"
55         excludes="$excludes --exclude=/bin64"
56
57         case `uname`:`uname -m` in
58                 Darwin:*)
59                         excludes="$excludes --exclude=/xonotic-linux*"
60                         excludes="$excludes --exclude=/fteqcc/fteqcc.linux*"
61                         ;;
62                 Linux:x86_64)
63                         excludes="$excludes --exclude=/Xonotic*.app"
64                         excludes="$excludes --exclude=/xonotic-osx-*"
65                         excludes="$excludes --exclude=/fteqcc/fteqcc.osx"
66                         if [ -z "$XONOTIC_INCLUDE_32BIT" ]; then
67                                 excludes="$excludes --exclude=/xonotic-linux32-*"
68                                 excludes="$excludes --exclude=/fteqcc/fteqcc.linux32"
69                         fi
70                         ;;
71                 Linux:i?86)
72                         excludes="$excludes --exclude=/Xonotic*.app"
73                         excludes="$excludes --exclude=/xonotic-osx-*"
74                         excludes="$excludes --exclude=/fteqcc/fteqcc.osx"
75                         excludes="$excludes --exclude=/xonotic-linux64-*"
76                         excludes="$excludes --exclude=/fteqcc/fteqcc.linux64"
77                         ;;
78                 *)
79                         echo >&2 "WARNING: Could not detect architecture - downloading all architectures"
80                         ;;
81         esac
82 fi
83
84 rsync $options $excludes "$url" "$target"