apply code review changes
This commit is contained in:
parent
9c9a750009
commit
499837bd80
4 changed files with 8 additions and 10 deletions
|
@ -55,10 +55,9 @@ function get_checksum_command {
|
||||||
|
|
||||||
# get checksum command
|
# get checksum command
|
||||||
CHECKSUM_COMMAND=$(get_checksum_command)
|
CHECKSUM_COMMAND=$(get_checksum_command)
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
# no command found
|
# no command found
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
if (($?)); then
|
||||||
# return original exit status of yadm command
|
# return original exit status of yadm command
|
||||||
exit "$YADM_HOOK_EXIT"
|
exit "$YADM_HOOK_EXIT"
|
||||||
fi
|
fi
|
||||||
|
@ -67,7 +66,7 @@ fi
|
||||||
echo -n > "$YADM_CHECKSUMS"
|
echo -n > "$YADM_CHECKSUMS"
|
||||||
|
|
||||||
# calculate checksums for encrypted files
|
# calculate checksums for encrypted files
|
||||||
for included in ${YADM_ENCRYPT_INCLUDE_FILES[*]}; do
|
for included in "${YADM_ENCRYPT_INCLUDE_FILES[@]}"; do
|
||||||
# highlight any errors in red
|
# highlight any errors in red
|
||||||
echo -en "\033[0;31m"
|
echo -en "\033[0;31m"
|
||||||
|
|
||||||
|
@ -79,7 +78,7 @@ for included in ${YADM_ENCRYPT_INCLUDE_FILES[*]}; do
|
||||||
echo -ne "\033[0m"
|
echo -ne "\033[0m"
|
||||||
|
|
||||||
# handle errors
|
# handle errors
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
if (($ERROR_CODE)); then
|
||||||
# display warning in bright yellow
|
# display warning in bright yellow
|
||||||
echo -e "\033[1;33m" >&2
|
echo -e "\033[1;33m" >&2
|
||||||
echo -n "WARNING: an error occurred. Please inspect the checksum file." >&2
|
echo -n "WARNING: an error occurred. Please inspect the checksum file." >&2
|
||||||
|
|
|
@ -30,7 +30,7 @@ fi
|
||||||
|
|
||||||
# list all files or only those in the subdirectories below?
|
# list all files or only those in the subdirectories below?
|
||||||
OPTION_LIST_ALL=0
|
OPTION_LIST_ALL=0
|
||||||
for argument in ${YADM_HOOK_FULL_COMMAND[*]}; do
|
for argument in "${YADM_HOOK_FULL_COMMAND[@]}"; do
|
||||||
# mimick git ls-files by displaying all files when not on work
|
# mimick git ls-files by displaying all files when not on work
|
||||||
# path
|
# path
|
||||||
if [ "$argument" = "-a" ] || [ $ON_WORK_PATH -eq 0 ]; then
|
if [ "$argument" = "-a" ] || [ $ON_WORK_PATH -eq 0 ]; then
|
||||||
|
@ -63,7 +63,7 @@ while IFS= read -r filename; do
|
||||||
else
|
else
|
||||||
echo "$filename"
|
echo "$filename"
|
||||||
fi
|
fi
|
||||||
done <<< "$(cat "$YADM_CHECKSUMS")"
|
done < "$YADM_CHECKSUMS"
|
||||||
|
|
||||||
# return original exit status of yadm command
|
# return original exit status of yadm command
|
||||||
exit "$YADM_HOOK_EXIT"
|
exit "$YADM_HOOK_EXIT"
|
||||||
|
|
|
@ -61,10 +61,9 @@ fi
|
||||||
|
|
||||||
# get checksum command
|
# get checksum command
|
||||||
CHECKSUM_COMMAND=$(get_checksum_command)
|
CHECKSUM_COMMAND=$(get_checksum_command)
|
||||||
ERROR_CODE=$?
|
|
||||||
|
|
||||||
# no command found
|
# no command found
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
if (($?)); then
|
||||||
# return original exit status of yadm command
|
# return original exit status of yadm command
|
||||||
exit "$YADM_HOOK_EXIT"
|
exit "$YADM_HOOK_EXIT"
|
||||||
fi
|
fi
|
||||||
|
@ -75,7 +74,7 @@ YADM_CHECKSUM_OUTPUT=$($CHECKSUM_COMMAND --check "$YADM_CHECKSUMS" 2>&1)
|
||||||
ERROR_CODE=$?
|
ERROR_CODE=$?
|
||||||
|
|
||||||
# handle mismatched checksums and errors
|
# handle mismatched checksums and errors
|
||||||
if [ $ERROR_CODE -ne 0 ]; then
|
if (($ERROR_CODE)); then
|
||||||
echo
|
echo
|
||||||
echo "Some SHA-256 sums do not match (or an error occurred):"
|
echo "Some SHA-256 sums do not match (or an error occurred):"
|
||||||
|
|
||||||
|
|
2
yadm
2
yadm
|
@ -1837,7 +1837,7 @@ function auto_bootstrap() {
|
||||||
|
|
||||||
function join_string {
|
function join_string {
|
||||||
local IFS="$1"
|
local IFS="$1"
|
||||||
echo "${*:2}"
|
printf "%s" "${*:2}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# ****** Prerequisites Functions ******
|
# ****** Prerequisites Functions ******
|
||||||
|
|
Loading…
Reference in a new issue