Skip to content

Instantly share code, notes, and snippets.

@Rorosha
Created October 13, 2014 20:39
Show Gist options
  • Save Rorosha/b7ee0a21a92f896bcce9 to your computer and use it in GitHub Desktop.
Save Rorosha/b7ee0a21a92f896bcce9 to your computer and use it in GitHub Desktop.
A script to run basic tests on Fedora images in the current directory
#!/bin/bash
# This script checks your locally downloaded files to see if they pass
# the Checksums [0] and ISO Size [1] testcases.
#
# [0] https://fedoraproject.org/wiki/QA:Testcase_Mediakit_Checksums
# [1] https://fedoraproject.org/wiki/QA:Testcase_Mediakit_ISO_Size
#
# Author: Mike Ruckman (roshi AT fedoraproject.org)
# Date: 2014-10-08
# Get all files
CHECKSUM_FILES=$(ls | grep CHECKSUM)
IMAGE_FILES=$(ls | grep ".iso\|.qcow2\|.raw.xz")
# Run sha256sum on each checksum file
echo "Validating sha256sum results..."
for file in $CHECKSUM_FILES; do
sha256sum -c $file
done
# Run checkisomd5 on each iso
echo "Validating checkisomd5 results..."
for file in $IMAGE_FILES; do
echo $file
checkisomd5 $file
done
# Check iso sizes
echo "Computing image sizes..."
#Print out requirements
let "netinst_size = 734003200"
let "dvd_size = 4700000000"
let "live_size = 2000000000"
subs_live=Live
subs_dvd=DVD
subs_net=netinst
for file in $IMAGE_FILES;
do
(( file_size= $(du -b $file | awk '{ print $1}') ))
if [ "${file/$subs_live}" ]; then
if [[ $live_size -gt $file_size ]]; then
echo "$file is within size limits."
fi
fi
if [ "${file/$subs_dvd}" ]; then
if [[ $dvd_size -gt $file_size ]]; then
echo "$file is within size limits."
fi
fi
if [ "${file/$subs_net}" ]; then
if [[ $netinst_size -gt $file_size ]]; then
echo "$file is within size limits."
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment