-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
build-rekor.sh
executable file
·54 lines (44 loc) · 1.21 KB
/
build-rekor.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
#!/bin/sh
set -e -v
d=$1
architecture=$2
PATH_CHROOT=$d.chroot.$architecture
MIRROR=""
if test "$d" == "buster" -o "$d" == "bullseye" -o "$d" == "unstable"; then
# deb.debian.org is failing too often
MIRROR=http://cloudfront.debian.net/debian
fi
if test ! -d $PATH_CHROOT; then
echo "Create $PATH_CHROOT chroot"
debootstrap --arch $architecture $d $PATH_CHROOT $MIRROR
fi
if test ! -e $PATH_CHROOT/proc/uptime; then
mount -t proc /proc $PATH_CHROOT/proc || true
fi
if test ! -e $PATH_CHROOT/dev/shm; then
mount --bind /dev/shm "$PATH_CHROOT/dev/shm" || true
fi
if test ! -e $PATH_CHROOT/dev/pts; then
mount --bind /dev/pts "$PATH_CHROOT/dev/pts" || true
fi
cat > $PATH_CHROOT/root/run.sh <<GLOBALEOF
#!/bin/bash
set -v
cd /root/
export PATH=/usr/lib/go/bin/:$PATH
export GOPATH=~/go/
rm -rf /rekor-cli rekor-cli $GOPATH
apt install -y golang-go git make
git clone https://github.com/sigstore/rekor.git rekor-cli
cd rekor-cli
make rekor-cli
strip rekor-cli
GLOBALEOF
chroot $PATH_CHROOT/ bash ./root/run.sh
cp $PATH_CHROOT/root/rekor-cli/rekor-cli rekor
ls -al rekor
file rekor
if test $architecture != "i386"; then
# Don't run it on i386 as it runs on amd64
./rekor version
fi