Advertisement
valdeEdius

init.sh

Apr 9th, 2012
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.80 KB | None | 0 0
  1. #!/bin/bash
  2. #############################################
  3. # Asks User to screen size and saves as REZ #
  4. #############################################
  5. if [ -a /root/bootdefaults.txt ]
  6. then
  7. REZ=$(<root/bootdefaults.txt)
  8. else
  9. echo "Now enter the screen size you want in pixels (e.g. 800x480), followed by [ENTER]:"
  10. read REZ
  11. echo "Save this as default? (y/n)"
  12. read answer
  13. if [ $answer == y ]
  14. then
  15. echo $REZ >> root/bootdefaults.txt
  16. fi
  17. fi
  18.  
  19.  
  20. ###########################################
  21. # Tidy up previous LXDE and DBUS sessions #
  22. ###########################################
  23. rm /tmp/.X* > /dev/null 2>&1
  24. rm /tmp/.X11-unix/X* > /dev/null 2>&1
  25. rm /root/.vnc/localhost* > /dev/null 2>&1
  26. rm /var/run/dbus/pid > /dev/null 2>&1
  27.  
  28. ############################################################
  29. # enable workaround for upstart dependent installs #
  30. # in chroot'd environment. this allows certain packages #
  31. # that use upstart start/stop to not fail on install. #
  32. # this means they will have to be launched manually though #
  33. ############################################################
  34. dpkg-divert --local --rename --add /sbin/initctl > /dev/null 2>&1
  35. ln -s /bin/true /sbin/initctl > /dev/null 2>&1
  36.  
  37.  
  38. ###############################################
  39. # start vnc server with given resolution and #
  40. # DBUS server, (and optionally an SSH server) #
  41. ###############################################
  42. vncserver :0 -geometry $REZ
  43. dbus-daemon --system --fork > /dev/null 2>&1
  44. /etc/init.d/ssh start
  45.  
  46.  
  47. echo
  48. echo "If you see the message 'New 'X' Desktop is localhost:0' then you are ready to VNC into your ubuntu OS.."
  49. echo
  50. echo "If VNC'ing from a different machine on the same network as the android device use the 1st address below:"
  51. ##########################################
  52. # Output IP address of android device #
  53. ##########################################
  54. ifconfig | grep "inet addr"
  55.  
  56. echo
  57. 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)"
  58.  
  59. echo
  60. echo "To shut down the VNC server and exit the ubuntu environment, just enter 'exit' at this terminal - and WAIT for all shutdown routines to finish!"
  61. echo
  62.  
  63. ###############################################################
  64. # Spawn and interactive shell - this effectively halts script #
  65. # execution until the spawning shell is exited (i.e. you want #
  66. # to shut down vncserver and exit the ubuntu environment) #
  67. ###############################################################
  68. /bin/bash -i
  69.  
  70. #########################################
  71. # Disable upstart workaround and #
  72. # kill VNC server (and optionally SSH) #
  73. # Rename used xstartup to its first file#
  74. #########################################
  75. vncserver -kill :0
  76. /etc/init.d/ssh stop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement