diff --git a/files/home/hpf-ans/bin/ansible-pull.sh b/files/home/hpf-ans/bin/ansible-pull.sh index ecd9f9e..95b23ae 100644 --- a/files/home/hpf-ans/bin/ansible-pull.sh +++ b/files/home/hpf-ans/bin/ansible-pull.sh @@ -1,27 +1,32 @@ #!/usr/bin/env bash SCRIPT_NAME="$(basename "${0}")" +GIT_REPO_BRANCH="production" +OIC_FLAG="--only-if-changed" # - Process command line -GIT_REPO_BRANCH="production" while [ $# -gt 0 ]; do case "$1" in -h|--help) echo "Usage: $0 [--branch ]" exit 0 ;; - --branch) + -b|--branch) shift 1 if [ $# -eq 0 ] ; then echo "${SCRIPT_NAME}: ERROR - Branch not specified." ; exit 1 ; fi GIT_REPO_BRANCH="$1" shift 1 ;; + -f|--force) + shift 1 + OIC_FLAG="" + ;; --) shift 1 break ;; *) - echo "${SCRIPT_NAME}: ERROR - Invalid argument." ; exit 2 + echo "${SCRIPT_NAME}: ERROR - Invalid argument '${1}'." ; exit 2 ;; esac done @@ -55,4 +60,4 @@ echo echo "${SCRIPT_NAME}: $(date "+%Y-%m-%d %H:%M:%S")" # - Do our work -ansible-pull --only-if-changed --url "${GIT_REPO}" --checkout "${GIT_REPO_BRANCH}" "${@}" \ No newline at end of file +ansible-pull "${OIC_FLAG}" --url "${GIT_REPO}" --checkout "${GIT_REPO_BRANCH}" "${@}" \ No newline at end of file