corz.org uses cookies to remember that you've seen this notice explaining that corz.org uses cookies, okay!
set -e
tmpfile="/tmp/checksum.tmp"
me=${0
path=$1
case "$me" in
kconvert-winhashes)
zen=1
;;
convert-winhashes)
zen=0
;;
esac
if [ ! -x /usr/bin/zenity ] && [ $zen -eq 1 ]; then
zen=0
echo "*** NOTE ***"
echo "This script can use zentiy to display dialogs in your window manager. "
echo "To install zenity (on a Debian-based system, like Kubuntu) do.."
echo "sudo apt-get install zenity"
echo "For other systems, check your package manager's man page."
echo
fi
if [ "$path" = "" ]; then
if [ $zen -eq 1 ]; then
zenity --question --title "Error!!!" \
--text "Something bad happened. Please reinstall checksum!" \
--width=280 --timeout=20 --window-icon="$HOME/.local/share/icons/checksum.png"
else
echo
echo " *** NO PATH SPECIFIED! ***"
echo
echo "Usage: "$me" </path/to/hash/files>"
echo
fi
exit 1
fi
if [ $zen -eq 1 ]; then
zenity --notification --title "Windows Hash File Conversion" --text="Conversion in progress. This may take a moment." \
--window-icon="$HOME/.local/share/icons/checksum.png" &
notifypids="$!"
else
echo "converting windows hashes in $path"
echo "This may take a moment.."
echo
fi
if [ -d "$path" ];then
cd "$path"
find . -type f \( -name '*.md5' -o -name '*.sha1' -o -name '*.hash' \) -print | while read i;
do
if [ -f "${i}" ]; then
sed -i -e 's/\r//g' "${i}" | tee -a "$tmpfile"
fi
done
else
sed -i -e 's/\r//g' "$path" | tee -a "$tmpfile"
fi
if [ $zen -eq 1 ]; then
tail "$hashfile" | zenity --info ---title="Checksum" --text="All done with conversion!" \
--window-icon="$HOME/.local/share/icons/checksum.png"
kill "$notifypids"
else
echo
echo "All done with conversion!"
echo
fi
exit 0
Welcome to corz.org!
Since switching hosts (I hope you are alright, Ed! Wherever you are …) quite a few things seems to be wonky.
Juggling two energetic boys (of very different ages) on Coronavirus lockdown, I'm unlikely to have them all fixed any time soon. Mail me! to prioritise!