forked from puppetlabs-toy-chest/razor-el-mk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-livecd-root
executable file
·72 lines (53 loc) · 1.78 KB
/
build-livecd-root
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
#! /bin/bash
# the portion of building a livecd that needs to be run as root
# run this after running build-livecd
#
# The temp dir in which things happen is by default deleted when this
# script ends, unless an error happens or the KEEP_TMPDIR variable is set
function cleanup() {
if [ -n "$KEEP_TMPDIR" ]; then
echo "Not removing tmpdir $tmpdir"
else
[ -d $tmpdir ] && rm -rf $tmpdir
fi
}
if [ $(id -u) != 0 ]; then
echo "Please run this script as root"
exit 1
fi
trap cleanup EXIT
resultdir=$PWD
srcdir=$(realpath $(dirname $0))
tmpdir=$(mktemp -d /var/tmp/build-livecd-XXXXXX)
cd $srcdir
last_tag=$(git describe)
cd $tmpdir
echo Working in directory $tmpdir
echo "* Running livecd-creator"
livecd-creator -v --cache /var/cache/microkernel --config $srcdir/microkernel.ks -f microkernel || KEEP_TMPDIR=yes
echo "* Converting to initrd"
livecd-iso-to-pxeboot $tmpdir/microkernel.iso || KEEP_TMPDIR=yes
echo "* Building tarball"
mkdir microkernel
mv tftpboot/initrd0.img tftpboot/vmlinuz0 microkernel || KEEP_TMPDIR=yes
cd microkernel
cat > README <<EOF
This is a Microkernel for the new Razor
(https://github.com/puppetlabs/razor-server)
The microkernel was built from https://github.com/puppetlabs/razor-el-mk
at commit $last_tag
For instructions on how to set things up, read
https://github.com/puppetlabs/razor-server/wiki/Installation
To verify the kernel and initrd in this tar, run
sha256sum -c SHA256SUM
The SHA256SUM file is signed with my public key (FC6E8A22). You can verify it
by running
gpg --verify SHA256SUM.sig
EOF
sha256sum initrd0.img vmlinuz0 > SHA256SUM
cd ..
tarball=$srcdir/pkg/microkernel-${last_tag#release-}.tar
tar cf $tarball microkernel/
chown --reference $srcdir/build-livecd $tarball
echo "* Done"
echo "The microkernel is in $tarball"