Link to home
Create AccountLog in
Avatar of vePortal
vePortalFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Auto Install gnome & VNC Server.

Hi all,
I have recently had a request to develop a shell script that will take one standard "ubuntu" VPS and turn it into a Desktop system with VNC.

I have attached the code i come up with and using Expect for the VNC Password config which seems fine however shortly after wrighting the script i noticed that it requires user interaction.

Can anybody offer me a script that will install the desktop components and VNC Server. This is really confuzing me now and i need help.

my first expect script (apt-update.exp) answers a question about updating .conf files from distributor, Im not sure if theres a better way of doing this?

500 Points for the first with a working script please :)
cd /exapps
        ./apt-update.exp "$VEID" "N"

        # Install Desktop & VNC Server
        /usr/sbin/vzctl exec $VEID apt-get install -y gnome-desktop-environment xfonts-100dpi xfonts-100dpi-transcoded xfonts-75dpi xfonts-75dpi-transcoded xfonts-base vnc4server xinetd --fix-missing

        cd /exapps
        ./vncpass.exp "$VEID" "$VNCPASS"

        /usr/sbin/vzctl exec $VEID vncserver

Open in new window

Avatar of Steven Vona
Steven Vona
Flag of United States of America image

For user interaction you can use expect.

Are you familiar with perl or expect?
Avatar of vePortal

ASKER

I'm not familiar with either, I can about make-do with Expect however when installing the desktop utilities it asks you things like GEO Location, Keyboard layout etc, Both of which i have no idea how to pass the data onto it.
Well thats what expect does, you tell it to expect something (Like a password prompt) and then when it sees it, it then passes more info (like a password).

read more here:
http://search.cpan.org/~bnegrao/Net-SSH-Expect-1.09/lib/Net/SSH/Expect.pod

You can also look up expect, there is a ton of information on it on the net.  I can't write a script for you since I am not sure of what your trying to do or what questions would be asked.
The problem i've got is that i was under the impression "Expect" was used to enter data/user interaction and when it prompts you for keyboard config etc etc it asks you to select from a list, not simply "Type in" data.
if it is command line it should be asking you for a number like so:

1) option1
2) option2
3) option3

If you know what the options are you can use expect.

If you need to use the arrow keys to make a selection you can also use expect (depending on your environment of course)

up:    "\c[[A"
down:  "\c[[B"
left:  "\c[[D"
right: "\c[[C"

I'm pretty sure that it auto-detects the country i.e. if you are in ukraine it will come up with ukrane and therefore theres no way of telling which way to move with the arrows, There has got to be some way of pre-entering the data or passing it via the commandline areguments.
Well thats a whole different question...

What VNC software and what distro are you using.  I do not have a lot of experience with VNC but the few times I have used it on Fedora or RedHat I was never asked for a country or anything else.  For Fedora TigerVNC works out of the box, install and start it.

ASKER CERTIFIED SOLUTION
Avatar of vePortal
vePortal
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Sorted it myself.