From 0dfc40aaa8ba8e811c3b2c00f911bc67f6b8ddac Mon Sep 17 00:00:00 2001 From: ayakael Date: Sat, 7 Apr 2018 21:40:41 -0400 Subject: [PATCH] [cmd_*][parser] Exit code for missing database file is now 3 --- src/cmd_deploy | 2 +- src/cmd_du | 2 +- src/cmd_exclude | 2 +- src/cmd_fsck | 2 +- src/cmd_include | 2 +- src/cmd_update | 2 +- src/parser | 12 ++++++------ 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/cmd_deploy b/src/cmd_deploy index 7f6dd90..074c438 100644 --- a/src/cmd_deploy +++ b/src/cmd_deploy @@ -15,7 +15,7 @@ cmd_deploy() { local TARGET="${2}"; shift 2 local ERR=false local DB_FILE="${TARGET}/${_OPT_DB_FILE}" - [[ ! -f "${DB_FILE}" ]] && return 1 + [[ ! -f "${DB_FILE}" ]] && return 3 [[ ! -d "${GIT_DIR}/.git" ]] && return 2 if [[ -z "$(grep LAST_DEPLOY ${DB_FILE})" ]]; then diff --git a/src/cmd_du b/src/cmd_du index b0d0fc5..3ea31ab 100644 --- a/src/cmd_du +++ b/src/cmd_du @@ -14,7 +14,7 @@ cmd_du() { local GIT_DIR="${1}" local TARGET="${2}" local DB_FILE="${TARGET}/${_OPT_DB_FILE}" - [[ ! -f "${DB_FILE}" ]] && return 1 + [[ ! -f "${DB_FILE}" ]] && return 3 [[ ! -d "${GIT_DIR}/.git" ]] && return 2 local imageidList=($(awk 'BEGIN{FS="\t"}{if($1=="true"){print $2}}' ${DB_FILE} | awk '!seen[$0]++')) diff --git a/src/cmd_exclude b/src/cmd_exclude index 781c82a..4daa7a8 100644 --- a/src/cmd_exclude +++ b/src/cmd_exclude @@ -20,7 +20,7 @@ cmd_exclude() { local TARGET="${2}" local DB_FILE="${TARGET}/${_OPT_DB_FILE}"; shift 2 local conditionList=("${@}") - [[ ! -f "${DB_FILE}" ]] && return 1 + [[ ! -f "${DB_FILE}" ]] && return 3 [[ ! -d "${GIT_DIR}/.git" ]] && return 2 for condition in ${conditionList[@]}; do diff --git a/src/cmd_fsck b/src/cmd_fsck index b3a4f08..90d43e9 100644 --- a/src/cmd_fsck +++ b/src/cmd_fsck @@ -14,7 +14,7 @@ cmd_fsck() { local GIT_DIR="${1}" local TARGET="${2}" local DB_FILE="${TARGET}/${_OPT_DB_FILE}" - [[ ! -f "${DB_FILE}" ]] && return 1 + [[ ! -f "${DB_FILE}" ]] && return 3 [[ ! -d "${GIT_DIR}/.git" ]] && return 2 chk_deployed_ids "${TARGET}" "${DB_FILE}" diff --git a/src/cmd_include b/src/cmd_include index a6d3287..39945db 100644 --- a/src/cmd_include +++ b/src/cmd_include @@ -20,7 +20,7 @@ cmd_include() { local TARGET="${2}" local DB_FILE="${TARGET}/${_OPT_DB_FILE}"; shift 2 local conditionList=("${@}") - [[ ! -f "${DB_FILE}" ]] && return 1 + [[ ! -f "${DB_FILE}" ]] && return 3 [[ ! -d "${GIT_DIR}/.git" ]] && return 2 for condition in ${conditionList[@]}; do diff --git a/src/cmd_update b/src/cmd_update index 8c5d828..8ac160c 100644 --- a/src/cmd_update +++ b/src/cmd_update @@ -14,7 +14,7 @@ cmd_update() { local GIT_DIR="${1}" local TARGET="${2}" local DB_FILE="${TARGET}/${_OPT_DB_FILE}" - [[ ! -f "${DB_FILE}" ]] && return 1 + [[ ! -f "${DB_FILE}" ]] && return 3 [[ ! -d "${GIT_DIR}/.git" ]] && return 2 # In the event that LAST_COMMIT OR DB_FILE does not exist, echo out that the LAST_COMMIT diff --git a/src/parser b/src/parser index 3d30a6f..94f879b 100644 --- a/src/parser +++ b/src/parser @@ -46,7 +46,7 @@ case "${1}" in shift cmd_exclude "${GIT_DIR}" ${@} EXIT=$? - [[ ${EXIT} -eq 1 ]] && echo "Database file non-existent" + [[ ${EXIT} -eq 3 ]] && echo "Database file non-existent" [[ ${EXIT} -eq 2 ]] && echo "Git directory not a valid git repository" ;; @@ -54,7 +54,7 @@ case "${1}" in shift cmd_include$ "${GIT_DIR}" ${@} EXIT=$? - [[ ${EXIT} -eq 1 ]] && echo "Database file non-existent" + [[ ${EXIT} -eq 3 ]] && echo "Database file non-existent" [[ ${EXIT} -eq 2 ]] && echo "Git directory not a valid git repository" ;; @@ -62,7 +62,7 @@ case "${1}" in shift cmd_deploy "${GIT_DIR}" ${@} EXIT=$? - [[ ${EXIT} -eq 1 ]] && echo "Database file non-existent" + [[ ${EXIT} -eq 3 ]] && echo "Database file non-existent" [[ ${EXIT} -eq 2 ]] && echo "Git directory not a valid git repository" ;; @@ -70,7 +70,7 @@ case "${1}" in shift cmd_update "${GIT_DIR}" ${@} EXIT=$? - [[ ${EXIT} -eq 1 ]] && echo "Database file non-existent" + [[ ${EXIT} -eq 3 ]] && echo "Database file non-existent" [[ ${EXIT} -eq 2 ]] && echo "Git directory not a valid git repository" ;; @@ -78,7 +78,7 @@ case "${1}" in shift cmd_du "${GIT_DIR}" "${@}" EXIT=$? - [[ ${EXIT} -eq 1 ]] && echo "Database file non-existent" + [[ ${EXIT} -eq 3 ]] && echo "Database file non-existent" [[ ${EXIT} -eq 2 ]] && echo "Git directory not a valid git repository" ;; @@ -86,7 +86,7 @@ case "${1}" in shift cmd_fsck "${GIT_DIR}" "${@}" EXIT=$? - [[ ${EXIT} -eq 1 ]] && echo "Database file non-existent" + [[ ${EXIT} -eq 3 ]] && echo "Database file non-existent" [[ ${EXIT} -eq 2 ]] && echo "Git directory not a valid git repository" ;; esac