blob: 6a1d578418a1812e87bd8b45508745ebd76b52f5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
#!/bin/bash
set -e
DISTROLIST=()
ROOTPATH=
DEVNAME=
KERNELDIR=
DATADIR=
. functions.sh
msg() {
echo -e "$1" >&2
}
errmsg() {
msg "\x1b[1;31m$1\x1b[0m"
}
usage() {
msg "$0 --root=<rootpath> --dev=<devname> [distro 1] [distro 2] ..."
}
while [[ -n "$1" ]]
do
case "$1" in
--root=*)
ROOTPATH=${1/--root=}
if [ -d "$ROOTPATH" ]; then
KERNELDIR="$ROOTPATH/liveusb-kernel"
DATADIR="$ROOTPATH/liveusb-data"
install -d "$KERNELDIR" "$DATADIR"
msg "Files will be copy to $ROOTPATH"
else
errmsg "Invalid root path $ROOTPATH"
fi
;;
--dev=*)
DEVNAME=${1/--dev=}
msg "Boot sector will be written to $DEVNAME"
;;
*=*)
usage
exit 1
;;
*)
if [ -d "distro/$1" ]
then
DISTROLIST=(${DISTROLIST[@]} "$1")
else
errmsg "directory distro/$1 not found"
exit 1
fi
;;
esac
shift
done
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
errmsg "$ISOFILE checksum bad!"
exit 1
fi
else
errmsg "File isofiles/$ISOFILE not found!"
exit 1
fi
install_live
done
|