Advertisement
metalx1000

Debian Chroot Script for Android

Aug 9th, 2014
483
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.87 KB | None | 0 0
  1. #!/system/bin/sh
  2. #mounts and chroots debian system on Android
  3. #might need to create loop
  4. #busybox mknod /dev/loop0 b 7 0
  5. #busybox mknod -m640 /dev/block/loop255 b 7 255
  6.  
  7. #to install this script you need to make system RW
  8. #mmcblk0p5 might change so check 'mount' command
  9. #mount -o remount,rw /dev/block/mmcblk0p5 /system
  10. #on Lollipop run this to stop ld.so ERROR  -- unset LD_PRELOAD
  11. dir=/storage/sdcard1/
  12. chroot=${dir}debian
  13. img=${dir}debian_arm.img
  14.  
  15. mounts () {
  16.     mount -o loop -t ext4 $img $chroot
  17.     busybox mount --bind /dev $chroot/dev
  18.     busybox mount --bind /dev/pts $chroot/dev/pts
  19.     busybox mount -t proc proc $chroot/proc
  20.     busybox mount -t sysfs sysfs $chroot/sys
  21. }
  22.  
  23. mount|grep "$chroot"&&echo "Already Mounted"|| mounts
  24.  
  25. export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
  26. export TERM=linux
  27. export HOME=/root
  28. export USER=root
  29.  
  30. busybox chroot $chroot /bin/bash
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement