forked from freeciv/freeciv-web
-
Notifications
You must be signed in to change notification settings - Fork 1
/
dl_freeciv_default.sh
executable file
·28 lines (23 loc) · 1.2 KB
/
dl_freeciv_default.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
# Places the specified revision of Freeciv in freeciv/freeciv/
# This is the default. The script dl_freeciv.sh will run instead of
# dl_freeciv_default.sh if it exists.
# If you want to modify this file copy it to dl_freeciv.sh and edit it.
echo "Updating freeciv to commit $1"
# Remove old version
echo " removing existing source"
rm -Rf freeciv
# Download the wanted Freeciv revision from GitHub unless it is here already.
# The download step saves having to merge in Freeciv's history each time the
# Freeciv server revision is updated.
echo " fetching missing revisions"
git cat-file -e $1 || git fetch --no-tags "$2" "$3":freeciv_"$3"
# Place the requested Freeciv revision in the freeciv/freeciv folder.
# The checkout isn't owned by git. This means that the patches automatically
# applied during the build won't accidentally end up in commits. It also
# means that committing unrelated changes won't accidentally revert the
# Freeciv server revision because a command didn't run.
echo " checking out commit $1"
git read-tree --prefix=freeciv/freeciv/ --index-output=.freeciv_index $1
mkdir freeciv && cd freeciv && GIT_INDEX_FILE=.freeciv_index git checkout-index -af && cd ..
rm -f ../.freeciv_index