[cmd_*][parser] Exit code for missing database file is now 3

This commit is contained in:
ayakael 2018-04-07 21:40:41 -04:00
parent 7ae4f59c5d
commit 0dfc40aaa8
No known key found for this signature in database
GPG key ID: 575626A4AE5F4026
7 changed files with 12 additions and 12 deletions

View file

@ -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

View file

@ -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]++'))

View file

@ -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

View file

@ -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}"

View file

@ -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

View file

@ -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

View file

@ -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