diff options
Diffstat (limited to 'storage')
| -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 + |
