archive : update colors.

This commit is contained in:
Dmitry Voronin 2023-11-08 20:30:54 +03:00
parent abcc77501f
commit 6a8c1b0ba0

View file

@ -35,7 +35,7 @@ archive()
mv "${target%/*}".txz "${target%/*}"_${date}-$(pv "${target%/*}".txz | sha1sum | cut -d\ -f1).txz mv "${target%/*}".txz "${target%/*}"_${date}-$(pv "${target%/*}".txz | sha1sum | cut -d\ -f1).txz
# report success. # report success.
echo -e "${color_green}${status}: done.${color_default}" echo -e "${color_green}${status}: Done.${color_default}"
done done
} }
@ -70,7 +70,7 @@ archive_fast()
mv "${target%/*}".tgz "${target%/*}"_${date}-$(pv "${target%/*}".tgz | sha1sum | cut -d\ -f1).tgz mv "${target%/*}".tgz "${target%/*}"_${date}-$(pv "${target%/*}".tgz | sha1sum | cut -d\ -f1).tgz
# report success. # report success.
echo -e "${color_green}${status}: done.${color_default}" echo -e "${color_green}${status}: Done.${color_default}"
done done
} }
@ -109,9 +109,9 @@ archive_check()
# compare hashes, show error on mismatch. # compare hashes, show error on mismatch.
if [[ "${actual}" = "${saved}" ]]; then if [[ "${actual}" = "${saved}" ]]; then
echo "${status}: validation OK." echo -e "${color_green}${status}: Validation OK.${color_default}"
else else
echo -e "${color_bred}${status}: validation failed.${color_default}" echo -e "${color_bred}${status}: Validation failed.${color_default}"
((failed++)) ((failed++))
fi fi
done done
@ -157,7 +157,7 @@ unarchive()
# extract if hash matched or show error if not. # extract if hash matched or show error if not.
if [[ "${saved}" = "${actual}" ]]; then if [[ "${saved}" = "${actual}" ]]; then
echo "${status}: validation OK." echo "${status}: Validation OK."
# figure out the compression tool. # figure out the compression tool.
local compressor local compressor
@ -174,12 +174,12 @@ unarchive()
pv "${target}" | ${compressor} | tar -xf - pv "${target}" | ${compressor} | tar -xf -
else else
# report validation error & exit. # report validation error & exit.
echo -e "${color_bred}${status}: validation failed.${color_default}" echo -e "${color_bred}${status}: Validation failed.${color_default}"
return 1 return 1
fi fi
# report extraction complete. # report extraction complete.
echo -e "${color_green}${status}: done.${color_default}" echo -e "${color_green}${status}: Done.${color_default}"
done done
} }
@ -221,13 +221,13 @@ archive_name()
# check for the same name. # check for the same name.
if [[ "${target}" = "${new_name}" ]]; then if [[ "${target}" = "${new_name}" ]]; then
echo -e "${color_green}${status}: no change.${color_default}" echo -e "${color_yellow}${status}: No change.${color_default}"
continue continue
fi fi
# check for existing target. # check for existing target.
if [[ -f "${new_name}" ]]; then if [[ -f "${new_name}" ]]; then
echo -e "${color_bred}${status}: already exists.${color_default}" echo -e "${color_bred}${status}: Already exists.${color_default}"
return 1 return 1
fi fi