LINUX LITE 7.2 FINAL RELEASED - SEE RELEASE ANNOUNCEMENTS SECTION FOR DETAILS


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A simple way to check MD5sum
#24
(12-07-2014, 09:33 AM)misko_2083 link Wrote: Name: Checksum
Description: Calculates  checksum.
Command: /usr/scripts/checksum %f
Pattern: *
Appearance: Check all the boxes except Directories

save the script as checksum
make executable
copy the file to /usr/scripts

I find the script rather useful. I've modified it to allow users to select a file just by launching the script. If the custom action in Thunar is configured, it will allow users to right-click and select files without prompting to browse for the file.

Extract and move the extracted files to their respective locations.

/usr/scripts/checksum
/usr/share/applications/checksum.desktop

Here is what it looks like:

[Image: mVZxS0C.png]

[Image: I1HNS17.png]

[Image: bjIYcAt.png]

[Image: 1JTLorM.png]

[Image: 7sKrZU4.png]

Cheers!


Code:
#!/bin/bash
# Misko_2083, Ralphy
ic="/usr/share/icons/Faenza/actions/32/system-run.png"
# user selected file
file="$@"
if [ -z "$@" ]; then szPath=$(zenity --file-selection --title="Checksum - Select file..." --file-filter='Image files (ISO,IMG) | *.iso *.ISO *.img *.IMG' --file-filter='All files | *');
if [ "$?" -eq "1" ]; then exit 0; else file="$szPath"; fi; fi
while (true); do
MD5=(`echo "" | awk '{print "md5sum","✍","MD5", $0}'`); SHA1=(`echo "" | awk '{print "sha1sum","✍","SHA-1", $0}'`)
SHA224=(`echo "" | awk '{print "sha224sum","✍","SHA-224", $0}'`); SHA256=(`echo "" | awk '{print "sha256sum","✍","SHA-256", $0}'`)
SHA384=(`echo "" | awk '{print "sha384sum","✍","SHA-384", $0}'`); SHA512=(`echo "" | awk '{print "sha512sum","✍","SHA-512", $0}'`)
# main dialog
selected=$(zenity --list --width=180 --height=248 --window-icon="$ic" --hide-header --title=" Checksum" --text="File:  <b>${file##*/}</b>\n\nSelect the Hash algorithm\n" \
--hide-column="1" --separator="," --print-column="1,3" --column="Checksum" --column="" --column="Hash" "${MD5[@]}" "${SHA1[@]}" "${SHA224[@]}" "${SHA256[@]}" "${SHA384[@]}" "${SHA512[@]}")
# If Quit is clicked then exit
if [ "${PIPESTATUS[0]}" -ne "0" ]; then exit 0; fi
# read selection and split it
checksum=$(awk -F, '{print $1}' <<<$selected)
dialog=$(awk -F, '{print $2}' <<<$selected)
if [ "$checksum" == "" ]; then zenity --warning --window-icon="warning" --text="\nNo Hash algorithm was selected. Please try again. " --timeout="3"; continue; else :; fi
# temp sum file
TMPF="/tmp/sum"
# common function - if cancel then remove $TMPF and exit
action_cancel() { if [ "${PIPESTATUS[2]}" -ne "0" ]; then rm $TMPF; exit 0; fi }
action_sum() { sum=`cat $TMPF`; zenity --info --title="$dialog" --text="\nFile:<b> ${file##*/} </b>\n\n$dialog: $sum"; rm -f $TMPF & exit 0; }
"$checksum" "$file" | tee >(cut -d ' ' -f1 > $TMPF) |zenity --window-icon="info" --width=240 --progress --title="$dialog" --text="File:<b> ${file##*/} </b>\n\n- Calculating $dialog. Please wait..." --pulsate --auto-close
action_cancel
action_sum
done
exit


Attached Files
.zip   checksum.zip (Size: 2.04 KB / Downloads: 1,128)
https://unlockforus.com

Sorry for seeming stupid and preferring Linux - I just don't know any better.

[Image: AGxgqJ6.png]
Reply


Messages In This Thread
A simple way to check MD5sum - by misko_2083 - 08-20-2014, 12:59 AM
Re: A simple way to check MD5sum - by Valtam - 08-20-2014, 01:07 AM
Re: A simple way to check MD5sum - by rokytnji - 08-20-2014, 02:30 AM
Re: A simple way to check MD5sum - by misko_2083 - 08-20-2014, 09:11 AM
Re: A simple way to check MD5sum - by misko_2083 - 10-10-2014, 01:42 PM
Re: A simple way to check MD5sum - by rokytnji - 10-10-2014, 02:54 PM
Re: A simple way to check MD5sum - by misko_2083 - 10-10-2014, 03:36 PM
Re: A simple way to check MD5sum - by rokytnji - 10-10-2014, 05:00 PM
Re: A simple way to check MD5sum - by misko_2083 - 10-11-2014, 05:19 PM
Re: A simple way to check MD5sum - by rokytnji - 10-11-2014, 05:39 PM
Re: A simple way to check MD5sum - by mlsmith - 12-06-2014, 03:25 AM
Re: A simple way to check MD5sum - by misko_2083 - 12-06-2014, 06:25 AM
Re: A simple way to check MD5sum - by mlsmith - 12-06-2014, 03:38 PM
Re: A simple way to check MD5sum - by misko_2083 - 12-07-2014, 02:13 AM
Re: A simple way to check MD5sum - by misko_2083 - 12-07-2014, 09:33 AM
Re: A simple way to check MD5sum - by mlsmith - 12-07-2014, 01:17 PM
Re: A simple way to check MD5sum - by misko_2083 - 12-07-2014, 02:07 PM
Re: A simple way to check MD5sum - by gold_finger - 12-07-2014, 05:04 PM
Re: A simple way to check MD5sum - by mlsmith - 12-07-2014, 09:14 PM
Re: A simple way to check MD5sum - by misko_2083 - 12-09-2014, 03:02 AM
Re: A simple way to check MD5sum - by bitsnpcs - 01-14-2017, 05:56 PM
Re: A simple way to check MD5sum - by firenice03 - 01-14-2017, 07:27 PM
Re: A simple way to check MD5sum - by bitsnpcs - 01-14-2017, 11:51 PM
Re: A simple way to check MD5sum - by ralphy - 04-03-2017, 02:49 PM
Re: A simple way to check MD5sum - by Vera - 05-31-2017, 11:26 AM
Re: A simple way to check MD5sum - by ralphy - 05-31-2017, 01:53 PM
Re: A simple way to check MD5sum - by tuto - 09-06-2018, 12:40 AM

Forum Jump:


Users browsing this thread: 6 Guest(s)