forked from jerikan-network/cmdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run
executable file
·38 lines (34 loc) · 1.07 KB
/
run
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
#!/bin/sh
# Check which service we want to run. By default, this is "jerikan".
SERVICE=${SERVICE-"$(basename "$0")"}
case $SERVICE in
run-*) SERVICE=${SERVICE##run-} ;;
run) SERVICE=jerikan ;;
esac
case $(uname -s) in
Linux)
export oUID=$(id -u)
export oGID=$(id -g)
;;
Darwin)
# Adaptations for Docker for Mac
export oUID=0
export oGID=0
export SSH_AUTH_SOCK=/run/host-services/ssh-auth.sock
;;
esac
# Depending on the service, we may want to prepare some actions.
case $SERVICE in
jerikan|jerikan-*)
mkdir -p .cache~ output
;;
ansible-gitlab)
# Grab `output` from Gitlab. By default, latest master is
# used. Beware that local ansible/ content is still used.
remote=$(git for-each-ref --format='%(upstream:remotename)' refs/heads/master)
export SHA=${SHA:-$(git fetch -q ${remote} && git show-ref -s remotes/${remote}/master)}
docker-compose build ansible-gitlab
;;
esac
# Run the service
exec docker-compose run --rm ${SERVICE} "$@"