-
Notifications
You must be signed in to change notification settings - Fork 17
/
entrypoint.sh
56 lines (51 loc) · 1.28 KB
/
entrypoint.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
set -e
source ${GITLAB_MIRROR_ASSETS}/functions
add_user
fix_home_permissions
case ${1} in
mirrors|add|delete|ls|update|config|run|check-ssh)
check_environment
configure_gitlab_mirror
case ${1} in
mirrors)
exec_as_user "${GITLAB_MIRROR_INSTALL_DIR}/git-mirrors.sh" ${@:2}
;;
add)
exec_as_user "${GITLAB_MIRROR_INSTALL_DIR}/add_mirror.sh" ${@:2}
;;
delete)
exec_as_user "${GITLAB_MIRROR_INSTALL_DIR}/delete_mirror.sh" ${@:2}
;;
ls)
exec_as_user "${GITLAB_MIRROR_INSTALL_DIR}/ls-mirrors.sh" ${@:2}
;;
update)
exec_as_user "${GITLAB_MIRROR_INSTALL_DIR}/update_mirror.sh" ${@:2}
;;
config)
echo "Populated /config volume, please add ssh keys and configuration"
;;
run)
exec_as_user "${@:2}"
;;
esac
;;
help)
echo "Available options:"
echo " mirrors - Update all mirrors"
echo " add - Add a new mirror"
echo " delete - Delete a mirror"
echo " ls - List registered mirrors"
echo " update <project> - Update a single mirror"
echo " config - Populate the /config volume with ~/.ssh and other things"
echo " run <command> - Run an arbitrary command inside the container"
;;
*)
exec "$@"
;;
esac
if [[ -z $1 ]]
then
exec bash
fi