Advertisement
workdowg

archarm init script

Apr 20th, 2012
794
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.23 KB | None | 0 0
  1. #!/bin/bash
  2. #name this file archarm.init.sh
  3. ##########################################
  4. # This file goes in chroot /root dir #
  5. # This file needs to be executable #
  6. # chmod 755 archarm.init.sh #
  7. ##########################################
  8. #ArchArm init script(archarm.init.sh #
  9. #by workdowg - based on #
  10. #Ubuntu init.sh script #
  11. #Built by Zachary Powell (zacthespack) #
  12. #Thanks to: #
  13. #Johan (sciurius) #
  14. #Marshall Levin #
  15. #and to everyone at XDA! #
  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. #############################################
  23. # Asks User to screen size and saves as REZ #
  24. #############################################
  25. echo "Now enter the screen size you want in pixels (e.g. 800x480), followed by [ENTER]:"
  26.  
  27. read REZ
  28.  
  29. ##############################################
  30. # Pick which desktop environment to use, this#
  31. # is done by having a xstartup file for each #
  32. # desktop, then renaming the one you want to #
  33. # use to 'xstartup' before boot #
  34. ##############################################
  35. echo "Please select which Desktop environment you want to use, type the number to select it then press [ENTER]"
  36. echo "1 - LXDE"
  37. echo "2 - XFCE4"
  38. echo "Make your Selection:"
  39. read DESKTOP
  40. if [ $DESKTOP == 1 ]
  41. then
  42. mv /root/.vnc/lxstartup /root/.vnc/xstartup
  43. fi
  44. if [ $DESKTOP == 2 ]
  45. then
  46. mv /root/.vnc/xfce4startup /root/.vnc/xstartup
  47. fi
  48.  
  49. ###########################################
  50. # Tidy up previous LXDE and DBUS sessions #
  51. ###########################################
  52. rm /tmp/.X* > /dev/null 2>&1
  53. rm /tmp/.X11-unix/X* > /dev/null 2>&1
  54. rm /root/.vnc/localhost* > /dev/null 2>&1
  55. rm /var/run/dbus/pid > /dev/null 2>&1
  56.  
  57. ############################################################
  58. # enable workaround for upstart dependent installs #
  59. # in chroot'd environment. this allows certain packages #
  60. # that use upstart start/stop to not fail on install. #
  61. # this means they will have to be launched manually though #
  62. ############################################################
  63. dpkg-divert --local --rename --add /sbin/initctl > /dev/null 2>&1
  64. ln -s /bin/true /sbin/initctl > /dev/null 2>&1
  65.  
  66.  
  67. ###############################################
  68. # start vnc server with given resolution and #
  69. # DBUS server, (and optionally an SSH server) #
  70. ###############################################
  71. vncserver :0 -geometry $REZ
  72. dbus-daemon --system --fork > /dev/null 2>&1
  73. #/etc/rc.d/sshd start
  74.  
  75.  
  76. echo
  77. echo "If you see the message 'New 'X' Desktop is localhost:0' then you are ready to VNC into your ArchArm OS.."
  78. echo
  79. echo "If VNC'ing from a different machine on the same network as the android device use the 1st address below:"
  80. ##########################################
  81. # Output IP address of android device #
  82. ##########################################
  83. ifconfig | grep "inet addr"
  84.  
  85. echo
  86. echo "If using androidVNC, change the 'Color Format' setting to 24-bit colour, and once you've VNC'd in, change the 'input mode' to touchpad (in settings)"
  87.  
  88. echo
  89. echo "To shut down the VNC server and exit the ArchArm environment, just enter 'exit' at this terminal - and WAIT for all shutdown routines to finish!"
  90. echo
  91.  
  92. ###############################################################
  93. # Spawn and interactive shell - this effectively halts script #
  94. # execution until the spawning shell is exited (i.e. you want #
  95. # to shut down vncserver and exit the ArchArm environment) #
  96. ###############################################################
  97. /bin/bash -i
  98.  
  99. #########################################
  100. # Disable upstart workaround and #
  101. # kill VNC server (and optionally SSH) #
  102. # Rename used xstartup to its first file#
  103. #########################################
  104. vncserver -kill :0
  105. if [ $DESKTOP == 1 ]
  106. then
  107. mv /root/.vnc/xstartup /root/.vnc/lxstartup
  108. fi
  109. if [ $DESKTOP == 2 ]
  110. then
  111. mv /root/.vnc/xstartup /root/.vnc/xfce4startup
  112. fi
  113. #/etc/rc.d/sshd stop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement