Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- sudo apt-get install -y xfce4 xfce4-goodies tightvncserver expect
- export LC_CTYPE=en_US.UTF-8
- export LC_ALL=en_US.UTF-8
- mypass="secret" # not so
- expect <<EOF
- spawn "vncserver"
- expect "Password:"
- send "$mypass\r"
- expect "Verify:"
- send "$mypass\r"
- expect "Would you like to enter a view-only password (y/n)?"
- send "n\r"
- expect eof
- exit
- EOF
- vncserver -kill :1
- > ~/.vnc/xstartup
- cat <<EOT >> ~/.vnc/xstartup
- #!/bin/bash
- xrdb $HOME/.Xresources
- startxfce4 &
- EOT
- sudo chmod +x ~/.vnc/xstartup
- sudo su
- cat << "EOF" > /etc/init.d/vncserver
- #!/bin/bash
- PATH="$PATH:/usr/bin/"
- export USER="vagrant"
- DISPLAY="1"
- DEPTH="16"
- GEOMETRY="1024x768"
- OPTIONS="-depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY} -localhost"
- . /lib/lsb/init-functions
- case "$1" in
- start)
- log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}"
- su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"
- ;;
- stop)
- log_action_begin_msg "Stopping vncserver for user '${USER}' on localhost:${DISPLAY}"
- su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"
- ;;
- restart)
- $0 stop
- $0 start
- ;;
- esac
- exit 0
- EOF
- exit
- sudo chmod +x /etc/init.d/vncserver
- sudo service vncserver start
- sudo update-rc.d vncserver defaults
Add Comment
Please, Sign In to add comment