Posted August 6, 2009 at 03:08am in
Linux
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
Posted August 6, 2009 at 03:08am in
Linux
Tonight I was playing around with creating more templates in Ubuntu’s ~/Template directory and thought I’d play with MD5 files. This doesn’t just apply to the ~/Templates dir, but putting it in the templates directory will make it easier for a couple reasons. If you put this header in a MD5.md5 file and make that template executable, when you right click and create an MD5 file the file will be executable and will already have the shebang in the file.
An example, the following will let you run ./filename.md5 and have it return the results of the md5 check.
#!/usr/bin/md5sum -c
bf185a69398a7fa91b6006aae61f8be1 TracMercurial-0.11.0.7-py2.4.egg
$ chmod +x mercurial_plugin.md5
$ ./mercurial_plugin.md5
TracMercurial-0.11.0.7-py2.4.egg: OK