summaryrefslogtreecommitdiff
path: root/debootstrap.sh
diff options
context:
space:
mode:
authorReiner Herrmann <reiner@reiner-h.de>2016-01-31 00:39:43 +0100
committerReiner Herrmann <reiner@reiner-h.de>2016-01-31 00:44:06 +0100
commit42a9b2c087049f158c9f887a2e0950ebb2e717df (patch)
tree829a4e001eaad2f5dfdbba7aaa49a81604fdc4e8 /debootstrap.sh
Initial commit of v2
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
+