Advertisement
metalx1000

Debian for Android Chroot v2

Aug 9th, 2014
506
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.16 KB | None | 0 0
  1. #!/bin/bash
  2. img=debian_arm.img
  3. folder=debian
  4. release=sid
  5.  
  6. clear
  7. echo "Checking needed packages..."
  8. apt-get install binfmt-support qemu qemu-user-static debootstrap
  9.  
  10. echo "Creating empty IMG..."
  11. dd if=/dev/zero of=$img bs=1024 count=2000000
  12.  
  13. echo "Formating IMG..."
  14. mke2fs -Fj $img
  15. mkdir $folder
  16.  
  17. echo "Mounting IMG..."
  18. modprobe loop
  19. mount -t ext3 -o noatime,errors=remount-ro $img $folder || exit 1
  20.  
  21. echo "Starting Debootstrap..."
  22. debootstrap --foreign --arch armel $release $folder
  23. cp /usr/bin/qemu-arm-static $folder/usr/bin
  24.  
  25. DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
  26.  LC_ALL=C LANGUAGE=C LANG=C chroot $folder /debootstrap/debootstrap --second-stage
  27.  
  28. DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
  29.  LC_ALL=C LANGUAGE=C LANG=C chroot $folder dpkg --configure -a
  30.  
  31. echo "deb http://http.debian.net/debian $release main non-free contrib" > $folder/etc/apt/sources.list
  32. echo "export PATH=/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin" > $folder/root/.bashrc
  33. echo "export TERM=xterm" >> $folder/root/.bashrc
  34.  
  35.  
  36. for fs in /dev /proc /sys;
  37. do
  38.     mount -o bind "$fs" "$folder$fs"
  39. done
  40.  
  41. chroot $folder bash
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement