notes/Debian for Android Chroot v2-0UVFuSWR.sh
#!/bin/bash
img=debian_arm.img
folder=debian
release=sid
clear
echo "Checking needed packages..."
apt-get install binfmt-support qemu qemu-user-static debootstrap
echo "Creating empty IMG..."
dd if=/dev/zero of=$img bs=1024 count=2000000
echo "Formating IMG..."
mke2fs -Fj $img
mkdir $folder
echo "Mounting IMG..."
modprobe loop
mount -t ext3 -o noatime,errors=remount-ro $img $folder || exit 1
echo "Starting Debootstrap..."
debootstrap --foreign --arch armel $release $folder
cp /usr/bin/qemu-arm-static $folder/usr/bin
DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
LC_ALL=C LANGUAGE=C LANG=C chroot $folder /debootstrap/debootstrap --second-stage
DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
LC_ALL=C LANGUAGE=C LANG=C chroot $folder dpkg --configure -a
echo "deb http://http.debian.net/debian $release main non-free contrib" > $folder/etc/apt/sources.list
echo "export PATH=/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin" > $folder/root/.bashrc
echo "export TERM=xterm" >> $folder/root/.bashrc
for fs in /dev /proc /sys;
do
mount -o bind "$fs" "$folder$fs"
done
chroot $folder bash
syntax highlighted by Code2HTML, v. 0.9.1