summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbuildlive17
-rw-r--r--functions.sh23
2 files changed, 31 insertions, 9 deletions
diff --git a/buildlive b/buildlive
index 94b2101..e1c971f 100755
--- a/buildlive
+++ b/buildlive
@@ -32,6 +32,7 @@ do
|| fatalerror "UUID of $ROOTPATH not found, not a mountpoint?")"
KERNELDIR="$ROOTPATH/liveusb-kernel"
DATADIR="$ROOTPATH/liveusb-data"
+ GRUBCFG="$ROOTPATH/grub/grub.cfg"
install -d "$KERNELDIR" "$DATADIR"
msg "Files will be copy to $ROOTPATH"
;;
@@ -55,20 +56,18 @@ do
shift
done
+install -d "$ROOTPATH/grub"
+echo "uuid=$UUID" > "$GRUBCFG"
+
for i in ${DISTROLIST[@]}
do
- process_distro "$i"
- if [ -f "isofiles/$ISOFILE" ]; then
- CKSUM=$(sha256sum "isofiles/$ISOFILE" | cut -d' ' -f1)
- if [[ $CKSUM == $SHA256 ]]; then
- msg "$ISOFILE ok."
- else
- fatalerror "$ISOFILE checksum bad!"
- fi
+ process_distro "$i"
+ if [ -f "isofiles/$ISOFILE" ]; then
+ checksum_verify
else
fatalerror "File isofiles/$ISOFILE not found!"
fi
install_live
+ cat "distro/$i/grub.cfg" >> "$GRUBCFG"
done
-
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"