-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaica-docker.sh
executable file
·56 lines (51 loc) · 1.03 KB
/
aica-docker.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
function fn_exists () {
declare -f "$1" > /dev/null
echo $?
}
HELP_MESSAGE="Usage: aica-docker [server | interactive | connect]"
if [ -z "$1" ]; then
echo "${HELP_MESSAGE}"
exit 1
fi
# get the full path of the scripts, following the symlink if necessary
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
SYMLINK="${SCRIPT_DIR}"/aica-docker
if [[ -L "$SYMLINK" ]]; then
SCRIPT_DIR="$(readlink "$SYMLINK")"
SCRIPT_DIR="$(dirname "$SCRIPT_DIR")"
fi
case "$1" in
connect)
shift 1
if [ $(fn_exists "connect") == 0 ]; then
connect "$@"
else
source "${SCRIPT_DIR}"/src/connect.sh "$@"
fi
exit $?
;;
interactive)
shift 1
if [ $(fn_exists "interactive") == 0 ]; then
interactive "$@"
else
source "${SCRIPT_DIR}"/src/interactive.sh "$@"
fi
exit $?
;;
server)
shift 1
if [ $(fn_exists "server") == 0 ]; then
server "$@"
else
source "${SCRIPT_DIR}"/src/server.sh "$@"
fi
exit $?
;;
*)
echo "Unknown option: $1"
echo "${HELP_MESSAGE}"
exit 1
;;
esac