-
Notifications
You must be signed in to change notification settings - Fork 3
/
buildimage
executable file
·53 lines (44 loc) · 1.47 KB
/
buildimage
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
#!/bin/bash
IMAGE_NAME=danos-2105-base
function import_source() {
if [[ -n $DANOS_SRC_MOUNTED ]]; then
cp -a /mnt/src $IMAGE_NAME
else
wget -O- -q https://s3.us-west-1.amazonaws.com/2105.repos.danosproject.org/2105/livebuild/danos-2105-base-Build2.1.livebuild.tar | tar xv
fi
pushd $IMAGE_NAME
mkdir -p config/archives/
echo 'deb http://s3-us-west-1.amazonaws.com/2105.repos.danosproject.org/repo/ 2105 main' > config/archives/danos.list.chroot
echo -e 'Package: *\nPin: release o=DANOS\nPin-Priority: 1000' > config/archives/danos.pref.chroot
wget https://s3-us-west-1.amazonaws.com/repos.danosproject.org/Release.key -O config/archives/danos.key.chroot
popd
}
function import_preferred_packages() {
mkdir -p $IMAGE_NAME/config/packages.chroot/
cp /mnt/pkgs/*.deb $IMAGE_NAME/config/packages.chroot/
}
function customize_apt() {
pushd $IMAGE_NAME
sed -i 's/--yes/--yes --force-yes/' auto/config
popd
}
function build_image() {
pushd $IMAGE_NAME
auto/config
auto/build
popd
}
function export_image() {
echo "exporting images... this may take a while"
cp $IMAGE_NAME/$IMAGE_NAME* /mnt/output
}
function workaround_919659() {
# Workaround https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=919659
sed -i '1161s%umount%#umount%' /usr/share/debootstrap/functions
}
workaround_919659 || exit 1
import_source || exit 1
import_preferred_packages
customize_apt || exit 1
build_image || exit 1
export_image || exit 1