-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathgenimages.sh
executable file
·75 lines (56 loc) · 2.14 KB
/
genimages.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
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
set -x
BUILDDIR=../
IMAGES=$(pwd)/images/
source ../common/build.sh
mkdir -p $IMAGES
mkdir -p data
# ========================================================================
# Generate nginx images (using nginx/ genimages script)
# ========================================================================
cp -r ${BUILDDIR}/fig_13_nginx-perf/data/* data/
${BUILDDIR}/fig_13_nginx-perf/genimages.sh
# in case redis/genimages.sh cleans up $IMAGES
IMAGES=$(pwd)/images/
mv $IMAGES nginx
# ========================================================================
# Generate redis images (using redis/ genimages script)
# ========================================================================
cp -r ${BUILDDIR}/fig_12_redis-perf/data/* data/
${BUILDDIR}/fig_12_redis-perf/genimages.sh
# see previous comment
IMAGES=$(pwd)/images/
mv $IMAGES redis
# ========================================================================
# Finalize
# ========================================================================
mkdir -p $IMAGES
mv redis $IMAGES
mv nginx $IMAGES
# ========================================================================
# Generate Lupine VM images + hello/sqlite ext2 rootfs
# ========================================================================
build_lupine
LUPINEDIR=${BUILDDIR}/.lupine
LUPINE_KPATH="${LUPINEDIR}/Lupine-Linux/kernelbuild/lupine-djw-kml-tiny++hello-world/vmlinux"
FIRECRACKER_PATH=.firecracker
if [ ! -f "$LUPINE_KPATH" ]; then
echo "Lupine not built, something went wrong..."
exit 1
fi
pushd ${LUPINEDIR}/Lupine-Linux/
sed -i -e "s/seek=20G/seek=30M/" ./scripts/image2rootfs.sh
# build image
./scripts/image2rootfs.sh hello-world latest ext2
docker pull hlefeuvre/alpine-sqlite
docker tag hlefeuvre/alpine-sqlite alpine-sqlite
./scripts/image2rootfs.sh alpine-sqlite latest ext2
# idempotence
git checkout ./scripts/image2rootfs.sh
popd
mv ${LUPINEDIR}/Lupine-Linux/hello-world.ext2 ${IMAGES}/hello.ext2
mv ${LUPINEDIR}/Lupine-Linux/alpine-sqlite.ext2 ${IMAGES}/sqlite.ext2
cp $LUPINE_KPATH images/lupine-hello.kernel
if [ ! -f "$FIRECRACKER_PATH" ]; then
ln -s ${LUPINEDIR}/Lupine-Linux/firecracker $FIRECRACKER_PATH
fi