Advertisement
workdowg

archarm boot script

Apr 20th, 2012
1,338
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.60 KB | None | 0 0
  1. #name this file archarm.sh
  2. ############################################
  3. # This file goes in the same directory as #
  4. # your archarm.img file #
  5. # run by typing "sh archarm.sh" #
  6. ############################################
  7. #ArchArm boot script (archarm.sh) based on #
  8. #Ubuntu boot script V6.1 for Android #
  9. #Built by Zachary Powell (zacthespack) #
  10. #Thanks to: #
  11. #Johan (sciurius) #
  12. #Marshall Levin #
  13. #and to everyone at XDA! #
  14. ############################################
  15. #Check for root #
  16. ############################################
  17. # This script has been modified to run #
  18. # Archlinux on the Acer Iconia A200 by #
  19. # workdowg (acertabletfurum) #
  20. # Thanks to all of the above #
  21. ############################################
  22. perm=$(id|cut -b 5)
  23. if [ "$perm" != "0" ];then echo "This script requires root! Type: su"; exit; fi
  24. mount -o remount,rw /dev/block/mmcblk0p5 /system
  25. ##########################################
  26. #Set up veriables #
  27. ##########################################
  28. export kit=$(dirname $0)
  29. export bin=/system/bin
  30. export mnt=/data/local/mnt
  31. export USER=root
  32. if [[ ! -d $mnt ]]; then mkdir $mnt; fi
  33. export PATH=$bin:/sbin:/usr/bin:/usr/local/bin:/usr/sbin:/bin:/usr/local/sbin:/usr/games:$PATH
  34. export TERM=xterm
  35. export HOME=/root
  36. export USER=root
  37. ##########################################
  38. #Set up loop device #
  39. ##########################################
  40. if [ -b /dev/block/loop255 ]; then
  41. echo "Loop device exists"
  42. else
  43. busybox mknod /dev/block/loop255 b 7 255
  44. fi
  45. #mount -o loop,noatime -t ext2 $kit/ubuntu.img $mnt
  46. busybox losetup /dev/block/loop255 $kit/archarm.img
  47. ##########################################
  48. #Mount all required partitions #
  49. ##########################################
  50. busybox mount -t ext2 /dev/block/loop255 $mnt
  51. busybox mount -o bind /dev $mnt/dev
  52. busybox mount -t devpts devpts $mnt/dev/pts
  53. busybox mount -t proc proc $mnt/proc
  54. busybox mount -t sysfs sysfs $mnt/sys
  55. busybox mount -o bind /sdcard $mnt/media/sdcard
  56.  
  57. ##########################################
  58. #Checks if you have a external sdcard #
  59. #and mounts it if you do #
  60. ##########################################
  61. if [ -d /mnt/external_sd ]; then
  62. busybox mount -o bind /mnt/external_sd $mnt/media/external_sd
  63. fi
  64. if [ -d /Removable/MicroSD ]; then
  65. busybox mount -o bind /Removable/MicroSD $mnt/external_sd
  66. fi
  67. ##########################################
  68. #Sets up network forwarding #
  69. ##########################################
  70. busybox sysctl -w net.ipv4.ip_forward=1
  71. echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
  72. echo "nameserver 8.8.4.4" >> $mnt/etc/resolv.conf
  73. echo "127.0.0.1 localhost" > $mnt/etc/hosts
  74. echo "Arch is configured with SSH and VNC servers that can be accessed from the IP:"
  75. ifconfig wlan0
  76. echo " "
  77. ##########################################
  78. #Chroot into ArchArm #
  79. ##########################################
  80. busybox chroot $mnt /root/archarm.init.sh
  81.  
  82. ##########################################
  83. #Shut down ArchArm #
  84. ##########################################
  85. echo "Shutting down ArchARM"
  86. for pid in `lsof | grep $mnt | sed -e's/ / /g' | cut -d' ' -f2`; do kill -9 $pid >/dev/null 2>&1; done
  87. sleep 5
  88. umount $mnt/media/sdcard
  89. umount $mnt/media/external_sd
  90. umount $mnt/dev/pts
  91. umount $mnt/proc
  92. umount $mnt/sys
  93. umount $mnt
  94. losetup -d /dev/block/loop255
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement