Remove linux 32bit binary support.
[xonotic/xonotic.git] / misc / tools / rsync-updater / update-to-release.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 case "${0##*/}" in
13         update-to-autobuild.sh)
14                 buildtype=autobuild
15                 ;;
16         *)
17                 buildtype=release
18                 ;;
19 esac
20
21 options="-Prtzil --executability --delete-after --delete-excluded --stats"
22
23 if [ -d "Xonotic-low" ]; then
24         url="rsync://beta.xonotic.org/$buildtype-Xonotic-low/"
25         target="Xonotic-low/"
26 elif [ -d "Xonotic-high" ]; then
27         url="rsync://beta.xonotic.org/$buildtype-Xonotic-high/"
28         target="Xonotic-high/"
29 elif [ -d "../../../.git" ]; then
30         echo >&2 "NOTE: this is a git repository download. Using the regular update method."
31         exec ../../../all update
32 elif [ -d "../../../data" ]; then
33         if [ -f ../../../data/xonotic-rsync-data-low.pk3 ]; then
34                 url="rsync://beta.xonotic.org/$buildtype-Xonotic-low/"
35         elif [ -f ../../../data/xonotic-*-data-low.pk3 ]; then
36                 url="rsync://beta.xonotic.org/$buildtype-Xonotic-low/"
37                 options="$options -y" # use fuzzy matching because file names differ
38         elif [ -f ../../../data/xonotic-rsync-data-high.pk3 ]; then
39                 url="rsync://beta.xonotic.org/$buildtype-Xonotic-high/"
40         elif [ -f ../../../data/xonotic-*-data-high.pk3 ]; then
41                 url="rsync://beta.xonotic.org/$buildtype-Xonotic-high/"
42                 options="$options -y" # use fuzzy matching because file names differ
43         elif [ -f ../../../data/xonotic-rsync-data.pk3 ]; then
44                 url="rsync://beta.xonotic.org/$buildtype-Xonotic/"
45         elif [ -f ../../../data/xonotic-*-data.pk3 ]; then
46                 url="rsync://beta.xonotic.org/$buildtype-Xonotic/"
47                 options="$options -y" # use fuzzy matching because file names differ
48         else
49                 echo >&2 "FATAL: unrecognized Xonotic build. This update script cannot be used."
50                 exit 1
51         fi
52         target="../../.."
53 else
54         url="rsync://beta.xonotic.org/$buildtype-Xonotic/"
55         target="Xonotic/"
56 fi
57
58 excludes=
59 if [ -z "$XONOTIC_INCLUDE_ALL" ]; then
60         excludes="$excludes --exclude=/*.exe"
61         excludes="$excludes --exclude=/gmqcc/*.exe"
62         excludes="$excludes --exclude=/bin32"
63         excludes="$excludes --exclude=/*.dll"
64         excludes="$excludes --exclude=/bin64"
65
66         case `uname`:`uname -m` in
67                 Darwin:*)
68                         excludes="$excludes --exclude=/xonotic-linux*"
69                         excludes="$excludes --exclude=/gmqcc/gmqcc.linux*"
70                         ;;
71                 Linux:x86_64)
72                         excludes="$excludes --exclude=/Xonotic*.app"
73                         excludes="$excludes --exclude=/xonotic-osx-*"
74                         excludes="$excludes --exclude=/gmqcc/gmqcc.osx"
75                         excludes="$excludes --exclude=/xonotic-linux32-*"
76                         excludes="$excludes --exclude=/gmqcc/gmqcc.linux32"
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"