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
|
#!/bin/bash
set -x
set -e
echo "To cache: attempting to cache $1"
if [ ! -e $1 ]; then
echo "$1 doesn't exist. Exiting"
exit 0
fi
if [ "x${cache}" = "x" ]; then
echo "No cache set. Exiting"
exit 0
fi
if [ "x$BUILD_NUMBER" = 'x' ]; then
echo "No build number - not caching"
exit 0
fi
thiscache=${cache}/${BUILD_NUMBER}
mkdir -p ${thiscache}
if md5sum --check $1.md5 --status; then
ln ${cache}/latest/$1 ${thiscache}/$1
else
cp --preserve $1 ${thiscache}/$1
fi
|