-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathmaster.sh
executable file
·65 lines (52 loc) · 1.92 KB
/
master.sh
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
#!/bin/bash
set -eu
BR2_CONFIG=buildroot/.config
test ! -d $(readlink -e ./buildroot) && echo "$0: Incorrect working directory: ./buildroot/ is missing. " && exit 1
test ! -r "$BR2_CONFIG" && echo "$0: $BR2_CONFIG is missing." && exit 2
eval $(grep -E '^BR2_(ARCH|GCC_TARGET_ARCH|LINUX_KERNEL_VERSION)=' "$BR2_CONFIG")
. dban.def
BR2_BZIMAGE="buildroot/output/images/bzImage"
OUTDIR=isoroot/${BR2_ARCH}/output
INDIR=isoroot/${BR2_ARCH}/input
VOLUME="DBAN v$DBAN_VERSION ($BR2_ARCH)"
ISOHYBRID=0
PRERELEASE=0
GIT_TAG=$(git describe --tags --exact-match 2>/dev/null || true)
if [ -z "$GIT_TAG" -o "${GIT_TAG%/*}" = "nightly" ]; then
GIT_VERSION=$(git log -1 --date=format:"%Y%m%d" --pretty=format:"%cd-g%h")
VOLUME="DBAN $GIT_VERSION"
PRERELEASE=1
fi
BZIMAGE_DIR=
MKISOFS_ARGS=()
case "${BR2_ARCH}" in
i586)
test ! -r "$INDIR/isolinux.bin" && echo "$0: $INDIR/isolinux.bin is missing." && exit 3
MKISOFS_ARGS+=(-b isolinux.bin -c isolinux.cat -no-emul-boot -boot-load-size 4 -boot-info-table)
MKISOFS_ARGS+=(-V "$VOLUME")
ISOHYBRID=1
;;
powerpc)
test ! -r "$INDIR/ppc/yaboot" && echo "$0: $INDIR/ppc/yaboot is missing." && exit 3
MKISOFS_ARGS+=(-chrp-boot -hfs -no-cache-inodes -no-desktop -part -r)
MKISOFS_ARGS+=(-map "$OUTDIR/ppc/map")
MKISOFS_ARGS+=(-hfs-bless "$OUTDIR/ppc")
MKISOFS_ARGS+=(-hfs-volid "$VOLUME")
BR2_BZIMAGE="buildroot/output/images/zImage"
BZIMAGE_DIR=ppc
;;
esac
test ! -r "$BR2_BZIMAGE" && echo "$0: $BR2_BZIMAGE is missing." && exit 4
if [ "$PRERELEASE" = "0" ]; then
OUTNAME="dban-${DBAN_VERSION}_linux-${BR2_LINUX_KERNEL_VERSION}_${BR2_ARCH}.iso"
else
OUTNAME="dban-${GIT_VERSION}_linux-${BR2_LINUX_KERNEL_VERSION}_${BR2_ARCH}.iso"
fi
rm -rf $OUTDIR
mkdir -p $OUTDIR
cp -r isoroot/generic/* $OUTDIR/
cp -r $INDIR/* $OUTDIR/
cp -v "$BR2_BZIMAGE" "$OUTDIR/$BZIMAGE_DIR/dban.bzi"
mkisofs -o "$OUTNAME" "${MKISOFS_ARGS[@]}" "$OUTDIR"
[ "$ISOHYBRID" = "1" ] && ./isohybrid "$OUTNAME"
ls -ll "$OUTNAME"