-
Notifications
You must be signed in to change notification settings - Fork 6
/
main.sh
executable file
·48 lines (42 loc) · 1.12 KB
/
main.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
#!/usr/bin/env bash
#
# dex version @VERSION@ build @BUILD@
# https://github.com/dockerland/dex
# Copyright 2016-present Brice Burgess, Licensed under the Apache License 2.0
#
main(){
set -eo pipefail
readonly CWD="$( pwd -P )"
[ -z "${BASH_SOURCE[0]}" ] || readonly SCRIPT_CWD="$( cd $(dirname ${BASH_SOURCE[0]}) ; pwd -P )"
readonly SCRIPT_BUILD="@BUILD@"
readonly SCRIPT_ENTRYPOINT="$0 $@"
readonly SCRIPT_VERSION="@VERSION@"
dex/conf-init
[ $# -eq 0 ] && die/help 1
while [ $# -ne 0 ]; do
case "$1" in
-v|--version|version)
echo "Dex version $SCRIPT_VERSION build $SCRIPT_BUILD" ; exit ;;
-h|--help)
die/help ;;
help)
is/fn "p/help_$2" || die "missing help for $2"
p/help_$2 ; exit ;;
conf|image|install|ls|ps|repo|run)
shell/execfn main_"$@" ;;
runfunc)
shift ; shell/execfn "$@" ;;
-*)
args/unknown "$1" "flag" ;;
*)
args/unknown "$1" "command" ;;
esac
shift
done
}
#@start dev-mode
for helper in $(find $(dirname $0})/lib.d/ -type f -name "*.sh"); do
. $helper
done
main "$@"
#@end dev-mode