1
0
mirror of https://github.com/jerikan-network/cmdb.git synced 2024-05-06 04:54:50 +00:00
Files
jerikan-network-cmdb/run
Vincent Bernat d191613ab8 Initial release
No history. If you have the original history, you can use:

```
git replace THISCOMMIT b0b998bd1c651e308ac71a9158e07e5c3521a281
```
2021-05-15 16:18:03 +02:00

39 lines
1.1 KiB
Bash
Executable File

#!/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} "$@"