use apt-cacher-ng if installed
[sysadmin-cookbook] / recepies / lxc / kvm / 01-setup / 01-create-kvm-root.sh
index 69f1ab8..a44293f 100755 (executable)
@@ -5,7 +5,12 @@ if [ -z "$SUDO_UID" ] ; then
        exit 1
 fi
 
-debootstrap --include=psmisc,less,strace,bzip2,make,gcc,libc6-dev,dropbear,lxc squeeze squeeze http://192.168.1.20:3142/ftp.debian.org/debian
+MIRROR=ftp.debian.org/debian
+dpkg -l apt-cacher-ng >/dev/null && MIRROR="127.0.0.1:3142/$MIRROR"
+
+echo "Using $MIRROR"
+
+debootstrap --include=psmisc,less,strace,bzip2,make,gcc,libc6-dev,dropbear,lxc,libc6-amd64 squeeze squeeze http://$MIRROR
 
 echo -e "root\nroot" | chroot squeeze passwd
 echo -e "auto lo\niface lo inet loopback\nauto eth0\niface eth0 inet dhcp" \