-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.sh
executable file
·36 lines (29 loc) · 831 Bytes
/
run.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
29
30
31
32
33
34
35
36
#!/bin/bash
#========================================================
# Script for storing and restoring cached directories
#
# See http://devcenter.wercker.com/docs/pipelines/wercker-cache.html
#========================================================
WERCKER_CACHE_SEPARATOR=${WERCKER_CACHE_SEPARATOR:-" "}
main() {
IFS=$WERCKER_CACHE_SEPARATOR directories=($WERCKER_CACHE_DIRECTORIES)
# set source and destination directories
case $WERCKER_CACHE_ACTION in
"store")
SRC=$HOME
DST=$WERCKER_CACHE_DIR
;;
"restore")
SRC=$WERCKER_CACHE_DIR
DST=$HOME
;;
esac
# run rsync
for directory in "${directories[@]}"; do
if test -d "${SRC}/${directory}"; then
echo "sync ${SRC}/${directory} ${DST}/"
rsync -avz "${SRC}/${directory}" "${DST}/"
fi
done
}
main