get rid of dependencies (pure bash)
This commit is contained in:
parent
45b218d5c1
commit
9c9a750009
2 changed files with 21 additions and 23 deletions
|
@ -46,28 +46,24 @@ if [ ! -f "$YADM_CHECKSUMS" ]; then
|
||||||
exit "$YADM_HOOK_EXIT"
|
exit "$YADM_HOOK_EXIT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# list encrypted files; try to satisfy the "list -a" argument and
|
# list encrypted files
|
||||||
# beautify the output (requires "grep" and "sed")
|
|
||||||
if command -v grep > /dev/null && command -v sed > /dev/null; then
|
|
||||||
# remove checksums from file names
|
|
||||||
while IFS= read -r filename; do
|
while IFS= read -r filename; do
|
||||||
if [ $OPTION_LIST_ALL -eq 0 ]; then
|
# remove checksums from file names
|
||||||
|
filename="${filename##[a-zA-Z0-9]* }"
|
||||||
|
|
||||||
# list only files in the subdirectories below (i.e. files
|
# list only files in the subdirectories below (i.e. files
|
||||||
# whose relative path doesn't begin with "../")
|
# whose relative path doesn't begin with "../")
|
||||||
|
if [ $OPTION_LIST_ALL -eq 0 ]; then
|
||||||
REL_PATH=$(relative_path "$PWD" "$YADM_HOOK_WORK/$filename")
|
REL_PATH=$(relative_path "$PWD" "$YADM_HOOK_WORK/$filename")
|
||||||
|
|
||||||
if ! echo "$REL_PATH" | grep '^\.\./' > /dev/null; then
|
if [ "$REL_PATH" = "${REL_PATH##../}" ]; then
|
||||||
echo "$REL_PATH"
|
echo "$REL_PATH"
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
# list all files
|
# list all files
|
||||||
|
else
|
||||||
echo "$filename"
|
echo "$filename"
|
||||||
fi
|
fi
|
||||||
done <<< "$(sed -r 's/^\S+\s+//' "$YADM_CHECKSUMS")"
|
done <<< "$(cat "$YADM_CHECKSUMS")"
|
||||||
else
|
|
||||||
# just display checksum file
|
|
||||||
cat "$YADM_CHECKSUMS"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# return original exit status of yadm command
|
# return original exit status of yadm command
|
||||||
exit "$YADM_HOOK_EXIT"
|
exit "$YADM_HOOK_EXIT"
|
||||||
|
|
|
@ -83,10 +83,12 @@ if [ $ERROR_CODE -ne 0 ]; then
|
||||||
echo -e "\033[0;31m"
|
echo -e "\033[0;31m"
|
||||||
|
|
||||||
while IFS= read -r line; do
|
while IFS= read -r line; do
|
||||||
# try to beautify output (requires "grep" and "sed")
|
# beautify output and get rid of unnecessary lines
|
||||||
if command -v grep > /dev/null && command -v sed > /dev/null; then
|
line="${line%%*: [Oo][Kk]}"
|
||||||
echo "$line" | grep -iv "\sok$" | sed 's/^/ / ; s/: FAILED$// ; /^.*WARNING:.*did NOT match$/ d'
|
line="${line%%: [Ff][Aa][Ii][Ll][Ee][Dd]}"
|
||||||
else
|
line="${line##*WARNING:*did NOT match}"
|
||||||
|
|
||||||
|
if [ -n "$line" ]; then
|
||||||
echo "$line"
|
echo "$line"
|
||||||
fi
|
fi
|
||||||
done <<< "$YADM_CHECKSUM_OUTPUT"
|
done <<< "$YADM_CHECKSUM_OUTPUT"
|
||||||
|
|
Loading…
Reference in a new issue