-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate
executable file
·52 lines (41 loc) · 1.05 KB
/
create
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
set -e
set -x
repo="https://github.com/DOMjudge/domjudge.git"
if [ -n "$1" ]; then
repo=$1
fi
if [ ! -d domjudge.git ]; then
git clone --bare $repo domjudge.git
fi
cd domjudge.git
git fetch $repo master:master
# this resets the date of FETCH_HEAD for further caching
lastcommitdate=`git show -s --format=%ct HEAD`
touch -d@$lastcommitdate FETCH_HEAD
git show HEAD:misc-tools/dj_make_chroot.in > ../dj_make_chroot.tmp
cd ..
tar cf domjudge.git.tar domjudge.git
# this resets the date of the tgz file
touch -d@$lastcommitdate domjudge.git.tar
set +e
diff -q dj_make_chroot dj_make_chroot.tmp
status=$?
set -e
if [ $status == 0 ]; then
rm dj_make_chroot.tmp
else
mv dj_make_chroot.tmp dj_make_chroot
chmod +x dj_make_chroot
sudo ./dj_make_chroot -d djchroot -a amd64
sudo rm -f djchroot.tar
sudo chown -R $USER djchroot
tar cf djchroot.tar djchroot
sudo rm -rf djchroot
fi
docker="/usr/bin/docker"
if [ -x "/usr/bin/docker.io" ]; then
# debian/Ubuntu uses docker.io instead of docker
docker="/usr/bin/docker.io"
fi
$docker build -t domjudge .