1

Trying to make a Thunar Custom Action for XFCE that gets the md5sum of the file you right click and compares it to the md5 in the clipboard, after a pattern match is used to check if what is in the clipboard is an md5. Then output the results in zenity.

I made an alias/function for cli in ~/.bashrc that works fine but I'm having issues adapting it to the custom action command:

~/.bashrc

alias md5c=md5_compare2clip

md5_compare2clip() {
clipmd5="$(xsel --clipboard | tr -d '\n')"
checkclipmd5="$(echo $clipmd5 | grep -e '[0-9a-f]\{32\}')"
if [[ "$checkclipmd5" < "1" ]];
then
echo "Missing MD5 in Clipboard"
else
f="$1"
echo "clipMD5: $checkclipmd5"
fileMD5="$(md5sum $f | awk '{print$1}')"
echo "fileMD5: $fileMD5"
if [[ "$fileMD5" == "$checkclipmd5" ]];
then
echo "MD5 Matches"
else
echo "MD5 Doesn't Match"
fi
fi
}

The reason I'm trying to do this is so I can just copy the md5 text from a webpage to the clipboard then just right click the downloaded iso and run md5compare custom action and get a popup dialog that says Match or No Match.

0 Answers0