diff options
author | Iru Cai <mytbk920423@gmail.com> | 2016-08-02 11:53:08 +0800 |
---|---|---|
committer | Iru Cai <mytbk920423@gmail.com> | 2016-08-02 12:31:58 +0800 |
commit | e750115fdd71ae3c26f954a667b7d33643b8aeb7 (patch) | |
tree | d575433bcc401597bea14f2a717d1f1fa54f25da /functions.sh | |
parent | 09aa7ff772730824e40c7162c2d2d58bcbec4070 (diff) | |
download | liveusb-builder-e750115fdd71ae3c26f954a667b7d33643b8aeb7.tar.xz |
buildlive: update checksum function, add grub.cfg
Diffstat (limited to 'functions.sh')
-rw-r--r-- | functions.sh | 23 |
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" |