#!/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