diff options
| author | Paul Buetow (europa) <paul@buetow.org> | 2015-06-20 10:06:36 +0100 |
|---|---|---|
| committer | Paul Buetow (europa) <paul@buetow.org> | 2015-06-20 10:06:36 +0100 |
| commit | ceb3b3ce56a511880bbd4e24de86a4f302814896 (patch) | |
| tree | a8df7d9bb77192887430e7983f565faeec0ee0f5 /storage/sdcard1 | |
| parent | 15a4dbc52ec4367327a895b386a0d65b0020e971 (diff) | |
add Debroid to Android userinit
Diffstat (limited to 'storage/sdcard1')
| -rw-r--r-- | storage/sdcard1/Linux/jessie.sh | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/storage/sdcard1/Linux/jessie.sh b/storage/sdcard1/Linux/jessie.sh new file mode 100644 index 0000000..0e5efe0 --- /dev/null +++ b/storage/sdcard1/Linux/jessie.sh @@ -0,0 +1,72 @@ +#!/bin/sh + +set -x + +export ARG=$1 +export ROOT=$(pwd)/jessie +export LOOP_DEVICE=/dev/block/loop1 +export SHELL=/bin/bash + +function start_services { + HOME=/root LD_PRELOAD='' chroot $ROOT $SHELL /etc/rc.debroid +} + +function enter_chroot { + HOME=/root LD_PRELOAD='' chroot $ROOT $SHELL -l +} + +function mount_chroot { + mountpoint $ROOT + if [ $? -ne 0 ]; then + losetup $LOOP_DEVICE $ROOT.img + busybox mount -t ext4 $LOOP_DEVICE $ROOT + fi + for mountpoint in proc dev sys dev/pts; do + mountpoint $ROOT/$mountpoint + if [ $? -ne 0 ]; then + busybox mount --bind /$mountpoint $ROOT/$mountpoint + fi + done + #busybox mount --bind /mnt/shell/emulated $ROOT/storage/sdcard0 + mountpoint $ROOT/storage/sdcard1 + if [ $? -ne 0 ]; then + busybox mount --bind /storage/sdcard1 $ROOT/storage/sdcard1 + fi +} + +function umount_chroot { + #busybox umount -f $ROOT/storage/sdcard0 + busybox umount -f $ROOT/storage/sdcard1 + for mountpoint in dev/pts proc dev sys; do + busybox umount -f $ROOT/$mountpoint + done + busybox umount -f $ROOT + losetup -d $LOOP_DEVICE +} + +case $ARG in + enter) + mount_chroot + enter_chroot + ;; + mount) + mount_chroot + ;; + umount) + umount_chroot + ;; + session) + mount_chroot + enter_chroot + umount_chroot + ;; + start_services) + mount_chroot + start_services + ;; + *) + echo "Usage: $0 session|mount|umount|enter|start_services" + exit 1 + ;; +esac + |
