-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·46 lines (37 loc) · 933 Bytes
/
install
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
#!/bin/bash
EXECUTION_PATH=$(cd `dirname $0` && pwd)
OPTS=`getopt -o hd: --long help,directory: -n 'parse-options' -- "$@"`
eval set -- "$OPTS"
DOCKER_COMPOSE_DIRECTORY=""
COMMANDS=("-d | --directory DOCKER_COMPOSE_DIRECTORY")
function usage() {
printf '%s\n\t' "Usage: $0" "${COMMANDS[@]}"
}
if [[ $# = 1 ]]; then
usage
exit 1
fi
while true
do
case "$1" in
-h | --help)
usage; exit 0 ;;
-d | --directory)
case "$2" in
"")
usage; exit 1 ;;
*)
DOCKER_COMPOSE_DIRECTORY=$2; shift 2 ;;
esac ;;
--)
shift; break ;;
*)
usage; exit 1 ;;
esac
done
if [ ! -d "$DOCKER_COMPOSE_DIRECTORY" ]; then
echo "$DOCKER_COMPOSE_DIRECTORY does not exist"
exit 0
fi
echo "Copying files to $DOCKER_COMPOSE_DIRECTORY ..."
cp -r $EXECUTION_PATH/bin $EXECUTION_PATH/examples $EXECUTION_PATH/templates $DOCKER_COMPOSE_DIRECTORY