Advertisement
metalx1000

Debian on Android Shell Script

Nov 17th, 2014
595
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.72 KB | None | 0 0
  1. #!/system/bin/sh
  2.  
  3. perm=$(id|busybox cut -b 5)
  4.  
  5. if [ "$perm" != "0" ]; then
  6.   echo "This Script Needs Root!"
  7.   exit
  8. fi
  9.  
  10. folder="/storage/sdcard1/"
  11. img="${folder}/debian_arm.img"
  12. mount="${folder}/debian"
  13.  
  14. #make sure mount is created
  15. busybox mkdir -p $mount
  16.  
  17. echo "loading Debian"
  18.  
  19. if [ -b /dev/loop2 ]; then
  20.     echo "Loop device exists"
  21. else
  22.     busybox mknod /dev/loop2 b 7 0
  23. fi
  24.  
  25. mount -o loop=/dev/block/loop2 -t ext4 $img $mount
  26. export bin=/system/bin
  27. export PATH=$bin:/usr/bin:/usr/local/bin:/usr/sbin:/bin:/usr/local/sbin:/usr/games:$PATH
  28. export HOME=/root
  29.  
  30. cd $mount
  31. busybox mount --bind /dev dev
  32. mount -t devpts devpts dev/pts
  33. mount -t proc proc proc
  34. mount -t sysfs sysfs sys
  35. busybox chroot . /bin/bash
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement