pullapply: unconditional hour now between 6am and midnight
[puppet-git.git] / ppg
blobfc609b19048b8d218fc298b859115157f9318748
1 #!/bin/bash
3 if [[ -n "${PPG_DEBUG}" ]]; then
4 set -x
5 fi
7 usage() {
8 echo "Usage: ppg COMMAND [OPTIONS] [TARGET]"
9 echo
10 echo "ppg commands are:"
12 cat <<\EOF | sed -e 's/^/ /'
14 For development environments
16 init-devenv Prepares a development/test environment for commits
17 commit Commits though to git
18 schedule Schedule a commit for merge to production
20 For puppet clients
22 clone Clones and inits a client environment
23 init Prepares a client environment after a "git clone"
24 pullapply Updates and applies config updates
25 apply Apply changes manually
27 EOF
30 # RHEL6/CentOS6 does not have /usr/bin/realpath
31 PPG_EXEC_PATH=$( dirname $(readlink -f "${BASH_SOURCE[0]}" ) )
33 cmd=
34 case "$#" in
35 0) usage
37 *) cmd="$1"
38 shift
39 case "$cmd" in
40 -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
41 echo "ppg version @@PPG_VERSION@@"
42 exit 0 ;;
43 -h|--help)
44 usage
45 exit 0;;
46 -*)
47 echo >&2 "ERROR: Unknown option $cmd"
48 usage
49 exit 1;
50 esac
52 if [[ -x "$PPG_EXEC_PATH/ppg-$cmd" ]]; then
53 exec "$PPG_EXEC_PATH/ppg-$cmd" "$@"
54 exit $?
55 else
56 echo >&2 "ERROR: Unknown command $cmd"
57 usage
58 exit 1;
61 esac