#!/bin/bash

# cleanup
rm -f *.zs-old rcksum-*

# enable nullglob (-u disable) - if no file is found, then loop is skipped
shopt -s nullglob

# update all iso files in current directory
cat <<EOT

Update ISO images:

EOT

for i in *.iso; do
	# download
	zsync -i ${i} -o ${i} http://nightly.kanotix.acritox.com/latest/${i}.zsync && wget -N https://iso.kanotix.com/${i}.md5

	# cleanup
	rm -f *.zs-old rcksum-*
done

# check files

cat <<EOT

Checking ISO images:

EOT

for m in *.md5; do
	md5sum -c ${m}
done
