summaryrefslogtreecommitdiff
path: root/functions.sh
diff options
context:
space:
mode:
Diffstat (limited to 'functions.sh')
-rw-r--r--functions.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/functions.sh b/functions.sh
index d4ddfc7..e44b8a7 100644
--- a/functions.sh
+++ b/functions.sh
@@ -1,4 +1,27 @@
+checksum_verify() {
+ local _hashtool _hashsum _cksum
+ if [ -n "$SHA256" ]; then
+ _hashtool=sha256sum
+ _hashsum=$SHA256
+ elif [ -n "$SHA1" ]; then
+ _hashtool=sha1sum
+ _hashsum=$SHA1
+ elif [ -n "$MD5" ]; then
+ _hashtool=md5sum
+ _hashsum=$MD5
+ else
+ fatalerror "Cannot find the SHA256, SHA1, or MD5 checksum of $ISOFILE"
+ fi
+ _cksum=$("$_hashtool" "isofiles/$ISOFILE" | cut -d' ' -f1)
+ if [[ $_cksum == $_hashsum ]]; then
+ msg "$ISOFILE ok."
+ else
+ fatalerror "$ISOFILE checksum bad!"
+ fi
+}
+
process_distro() {
+ unset MD5 SHA1 SHA256
source "distro/$1/install.sh"
ISOFILE="$(basename $ISOURL)"
ISOMNT="/media/$ISOFILE"