summaryrefslogtreecommitdiff
path: root/debootstrap.sh
diff options
context:
space:
mode:
Diffstat (limited to 'debootstrap.sh')
-rwxr-xr-xdebootstrap.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/debootstrap.sh b/debootstrap.sh
new file mode 100755
index 0000000..ead947d
--- /dev/null
+++ b/debootstrap.sh
@@ -0,0 +1,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
+