--- /dev/null
+These scripts are intended to ease the process of bootstrapping a Debian
+chroot on an Android device. Instructions for installing such a chroot
+may be found at:
+
+http://www.steven-mcdonald.id.au/tutorials/debian_on_samsung_galaxy.shtml
--- /dev/null
+#!/system/bin/sh
+
+# is /debian already mounted? if so, skip mounts
+if ! awk '{print $2}' /proc/mounts | grep -q '^/debian$'
+then
+ # create /debian
+ mkdir -p /debian
+
+ # mount /debian
+ mount -t ext3 -o noatime,errors=remount-ro /mnt/sdcard/debian.img /debian
+
+ # bind-mount special file systems from outside
+ for fs in /dev /proc /sys
+ do
+ mount -o bind "$fs" "/debian$fs"
+ done
+
+ # bind-mount android file systems so we can use them from debian
+ # busybox find has no -empty option so we have to do it like this
+ find /debian/android -type d |
+ while read dir
+ do
+ if test -z "$(ls $dir)"
+ then
+ echo "$dir"
+ fi
+ done |
+ sed 's,^/debian/android,,' |
+ while read fs
+ do
+ mount -o bind "$fs" "/debian/android$fs"
+ done
+fi
+
+# now start debian
+chroot /debian /usr/local/sbin/debian-init
--- /dev/null
+#!/system/bin/sh
+if whoami | grep -q '^root$'
+then
+ chroot /debian /usr/local/sbin/debian-sh
+else
+ su -c /data/local/bin/debian-sh
+fi
--- /dev/null
+#!/bin/sh
+
+# initialise debian system from outside the chroot
+# this script gets called from the android init system
+
+# first, set our PATH correctly
+# android uses a retarded PATH
+export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
+
+# what services do we want to start?
+services='
+hostname.sh
+rsyslog
+ssh
+atd
+cron
+rc.local
+'
+
+# start debian services
+for service in $services
+do
+ /usr/sbin/service "$service" start
+done
--- /dev/null
+#!/bin/sh
+
+# get rid of the retarded export PATH terminal emulator inflicts on us
+read foo
+unset foo
+
+export HOME='/root'
+export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
+export SHELL='/bin/bash'
+export TERM='xterm'
+
+clear
+cd
+/bin/bash