summaryrefslogtreecommitdiff
path: root/debootstrap.sh
blob: ead947d64e0967dea179bd209f63f384886a47ed (plain)
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
#!/bin/sh

set -e
set -x

# will use about 2.1 GB
DEBDIR=/tmp/debian-chroot

RELEASE=stretch
MIRROR=http://httpredir.debian.org/debian/

[ -f "build.sh" ] || exit 1

if [ $(pgrep -c apt-cacher-ng) -gt 0 ]; then
    MIRROR="http://localhost:3142/httpredir.debian.org/debian"
fi

debootstrap $RELEASE "$DEBDIR" "$MIRROR"
echo "deb-src $MIRROR $RELEASE main" >> "$DEBDIR/etc/apt/sources.list"

cp -a * "$DEBDIR/usr/src"

mknod "$DEBDIR/dev/loop0" b 7 0
chroot "$DEBDIR" /usr/src/build.sh