Right-click MD5 file generation, with autocheck
Posted August 6, 2009 at 03:08am in Linux with tags Bash Script, Gnome, MD5
In my previous post I mentioned using a shebang in MD5 files to make them autocheck. I created a quick nautilus script that will take selected files and create an md5 file with the shebang and append the hashes of the files to it. It will also make the MD5 file executable so that you can run that file to do the check.
The file gets placed in ~/.gnome2/nautilus-scripts/ and will take a restart of X.
#!/bin/bash
FILENAME=`gdialog --title "MD5 File" --inputbox "Enter the name of the MD5 file (without extension)" 100 200 2>&1`
if [ ${#FILENAME} -lt 1 ]; then
FILENAME=temp_name.md5
else
FILENAME=$FILENAME.md5
fi
echo "#!/usr/bin/md5sum -c" > $FILENAME
/usr/bin/md5sum $* >> $FILENAME
chmod +x $FILENAME
