forked from coopengo/coog-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsync
More file actions
executable file
·49 lines (42 loc) · 1.14 KB
/
sync
File metadata and controls
executable file
·49 lines (42 loc) · 1.14 KB
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
#!/bin/bash
if [ -z "$COOG_CODE_DIR" ] || [ ! -d "$COOG_CODE_DIR" ] || [ -z "$COOG_DATA_DIR" ]
then
{
echo "Please make sure that these two env vars are set:"
echo " COOG_CODE_DIR: your coog-admin install folder"
echo " COOG_DATA_DIR: the folder where to keep your custom config"
} >&2 && exit 1
fi
_build() {
( cd "$COOG_CODE_DIR/images/sync" && ./build "$@" )
}
_run() {
docker run \
$DOCKER_DAEMON_OPTS \
--network "$NETWORK_NAME" \
--name "$NETWORK_NAME-sync" \
-v "$SYNC_SRC:/src" \
-v "$SYNC_DEST:/dest" \
"$SYNC_IMAGE" /src/ /dest/
}
_docker() {
docker "$@" "$NETWORK_NAME-sync"
}
usage() {
echo
echo Available commands
echo
echo " build -> builds sync image"
echo " run -> runs a sync docker image"
echo " <action> -> calls docker action on sync container"
echo
}
main() {
source "$COOG_CODE_DIR/config"
[ -z "$1" ] && usage && return 0
local cmd; cmd="$1"; shift
[ "$cmd" = "build" ] && { _build "$@"; return $?; }
[ "$cmd" = "run" ] && { _run; return $?; }
_docker "$cmd" "$@"
}
main "$@"