Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #############################################
- # Asks User to screen size and saves as REZ #
- #############################################
- if [ -a /root/bootdefaults.txt ]
- then
- REZ=$(<root/bootdefaults.txt)
- else
- echo "Now enter the screen size you want in pixels (e.g. 800x480), followed by [ENTER]:"
- read REZ
- echo "Save this as default? (y/n)"
- read answer
- if [ $answer == y ]
- then
- echo $REZ >> root/bootdefaults.txt
- fi
- fi
- ###########################################
- # Tidy up previous LXDE and DBUS sessions #
- ###########################################
- rm /tmp/.X* > /dev/null 2>&1
- rm /tmp/.X11-unix/X* > /dev/null 2>&1
- rm /root/.vnc/localhost* > /dev/null 2>&1
- rm /var/run/dbus/pid > /dev/null 2>&1
- ############################################################
- # enable workaround for upstart dependent installs #
- # in chroot'd environment. this allows certain packages #
- # that use upstart start/stop to not fail on install. #
- # this means they will have to be launched manually though #
- ############################################################
- dpkg-divert --local --rename --add /sbin/initctl > /dev/null 2>&1
- ln -s /bin/true /sbin/initctl > /dev/null 2>&1
- ###############################################
- # start vnc server with given resolution and #
- # DBUS server, (and optionally an SSH server) #
- ###############################################
- vncserver :0 -geometry $REZ
- dbus-daemon --system --fork > /dev/null 2>&1
- /etc/init.d/ssh start
- echo
- echo "If you see the message 'New 'X' Desktop is localhost:0' then you are ready to VNC into your ubuntu OS.."
- echo
- echo "If VNC'ing from a different machine on the same network as the android device use the 1st address below:"
- ##########################################
- # Output IP address of android device #
- ##########################################
- ifconfig | grep "inet addr"
- echo
- 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)"
- echo
- 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!"
- echo
- ###############################################################
- # Spawn and interactive shell - this effectively halts script #
- # execution until the spawning shell is exited (i.e. you want #
- # to shut down vncserver and exit the ubuntu environment) #
- ###############################################################
- /bin/bash -i
- #########################################
- # Disable upstart workaround and #
- # kill VNC server (and optionally SSH) #
- # Rename used xstartup to its first file#
- #########################################
- vncserver -kill :0
- /etc/init.d/ssh stop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement