Skip to content

Instantly share code, notes, and snippets.

@rkennesson
Created June 1, 2019 20:19
Show Gist options
  • Save rkennesson/8339a6b87bb8729af9431cd4705e8572 to your computer and use it in GitHub Desktop.
Save rkennesson/8339a6b87bb8729af9431cd4705e8572 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Save this file in the ~/bin folder (or other convenient locations) as LM_iso_verify.sh
# When you want to check the integrity of the downloaded LMxx.x .iso file:
#
# Download or move your Mint xx.x.iso file to your Downloads folder.
# Move this LM_iso_verify.sh file to the Downloads folder
# and make sure it is marked as executable. (Or if you keep it in /home/<your user name>/bin,
# then it is should already be on the PATH, and you don't need to move it.)
#
# Open a terminal window and cd to ~/Downloads, then
# run the script with "./LM_iso_verify.sh Mint-xx.x-correct-filename.iso"
# EXAMPLE: ./LM_iso_verify.sh linuxmint-18.3-cinnamon-64bit.iso
# or if the script is in /home/bin or otherwise on the PATH, then
# EXAMPLE: LM_iso_verify.sh linuxmint-18.3-cinnamon-64bit.iso
# Check for one parameter on the command line (the .iso file name)
if [ $# -ne 1 ]; then
echo "Usage: $(basename "$0") linuxmint-xx.x-correct-filename.iso"
exit 1
fi
# Check if that file exists in the working directory and is readable
if [ ! -r "$1" ]; then
echo "File $1 does not exist or is not readable"
exit 1
fi
# Importing the signing key (LM18 and higher)
gpg --keyserver keyserver.ubuntu.com --recv-key "27DE B156 44C6 B3CF 3BD7 D291 300F 846B A25B AE09"
# This is for LM18.3 versions - modify these wget lines as needed for other versions
# Download the Mint 18.3 sha256 sum txt files
# If heanet.ie site isn't working, comment out these two lines and uncomment the wget lines for the alternate site
# or use another alternate of your choice.
wget https://ftp.heanet.ie/mirrors/linuxmint.com/stable/18.3/sha256sum.txt
wget https://ftp.heanet.ie/mirrors/linuxmint.com/stable/18.3/sha256sum.txt.gpg
# University of Oklahoma mirror - an alternate site if above heanet.ie isn't working
#wget http://reflection.oss.ou.edu/linuxmint/isos/linuxmint.com/stable/18.3/sha256sum.txt
#wget http://reflection.oss.ou.edu/linuxmint/isos/linuxmint.com/stable/18.3/sha256sum.txt.gpg
# Verify the signature on the sha256 sum text file
gpg --verify sha256sum.txt.gpg sha256sum.txt
echo "It should report that the signature is Good, $USER."
echo "You can ignore any warning about ...not certified..."
echo "..."
# compare the sha256 sum of your ISO image and the original Mint sha256 sum
echo "Calculating the sha256 sum for $1 and comparing it to the downloaded signed sha256 sum"
echo "Be patient, $USER. I am not that good at math"
echo "..."
sha256sum --check --ignore-missing sha256sum.txt
echo "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment