Writing an automated install script

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
Timeout
Level 4
Level 4
Posts: 183
Joined: Sat Feb 23, 2008 12:45 pm

Writing an automated install script

Post by Timeout »

Hi!

We will start on writing an automated install script for Trados on spare time, Friday next week.

Up to then I have to prepared the script *in a way that a developer will understand what I want* and being responsible for testing it under Linux.

Basically it will be an automated script which will be timed, i.e. if no install_ok after 20 min, it would be hanging somewhere and will abort and throw the log.
If install OK after the two runs (Trados and license server installation), it will throw a sign that the install is OK.

When prompted, the user will have each time 10 seconds to pick a choice, when after 10 seconds no choice is picked, the script will select the standard choice and continue.
If there is a choice, between yes and no, selected answer will be no (usually it is a question about "xxx install failed, do you wish to continue") unless the user has selected otherwise during the 10 seconds.

Now a couple of questions:
-In which language is exactly the script?
-What happens when the software is waiting for a prompt (like you have to click "next), is it written in unix or conform to the windows program as a dos prompt?

Maybe there will be more questions in the course in the week but it's what I can think of to start with.
Dan Kegel

Writing an automated install script

Post by Dan Kegel »

On Sat, Apr 5, 2008 at 11:23 PM, Timeout <[email protected]> wrote:
We will start on writing an automated install script for Trados on spare time, Friday next week.
Great. As a first approximation, I would suggest a simple
one that does not try to automate GUI functions, only
the easy stuff.
Up to then I have to prepared the script *in a way that a developer will
understand what I want* and being responsible for testing it under Linux.

Basically it will be an automated script which will be timed, i.e.
if no install_ok after 20 min, it would be hanging somewhere and will abort and throw the log.
If install OK after the two runs (Trados and license server installation), it will throw a sign that the install is OK.

When prompted, the user will have each time 10 seconds to pick a choice, when after 10 seconds no choice is picked, the script will select the standard choice and continue.
Too fancy IMHO.
Now a couple of questions:
-In which language is exactly the script?
I would start with a shell script. Don't even try to do anything GUI-like.
Just have the script wipe the .wine directory and do all the
winetricks steps neccessary, and start the windows installers.
-What happens when the software is waiting for a prompt (like you have to click "next), is it written in unix or conform to the windows program as a dos prompt?
You could use 'read' in the shell, but it's better to not have
anything like that.

Your goal should not be "wonderful automated installer" but
"bare minimum showing how to reproduce my problems".
- Dan
Timeout
Level 4
Level 4
Posts: 183
Joined: Sat Feb 23, 2008 12:45 pm

Re: Writing an automated install script

Post by Timeout »

Your goal should not be "wonderful automated installer" but
"bare minimum showing how to reproduce my problems".
Reproducing the problem is one thing but for that I don't need to go that far (it will crash after 2 min). It may have to be usable when it goes through and the installshied requires user interaction.

(Maybe I should add workarounds in comments)

The automated installer will abort at the first problem. The manual user however should be able to have time to answer because he knows how to go around these problems because even if a part is failing, sometimes the next is ok.

The whole GUI would be the one of the installshield.
I think the only GUI I may ask for is: "Do you want to install MS Office" with yes/no and a button to click when office is through to start with Trados/abort button. Automatic install will then skip MS office, but for later use it's a pain if you install MS office after Trados, you have to add manually the template in the start directory of office.

I won't build my workaround in the script (like pressing esc 2-3 times at a certain stage) :-)
Timeout
Level 4
Level 4
Posts: 183
Joined: Sat Feb 23, 2008 12:45 pm

Post by Timeout »

Here my first instructions, I may have to further explain until Friday and test that everything goes as I am used to.

Is the winetricks part OK

Code: Select all

Sprache: Shell

/* Condition is that all required files are saved in a directory ~/trados-installation/ */

wineprefixcreate
cp ~/trados-installation/SDLTrados2007_PRO_SP2_835.exe ~/.wine/drive_c/

Prüfen, ob die nachfolgende dlls sich in ./wine/drive_c/windows/system32, wenn nicht (oder welche die fehlen)
cp ~/trados-installation/fusion.dll, mfc42.dll, msvcr70.dll,secur32.dll ~/.wine/drive_c/windows/system32
cd ~/.wine/drive_c/windows/system32
wine regsvr32.exe msvcr70.dll
wine regsvr32.exe fusion.dll
wine regsvr32.exe mfc42.dll
wine regsvr32.exe secur32.dll

cd ../../../

*/download and execute winetricks/*

wget www.kegel.com/winetricks
winetricks corefonts gecko wsh56js fakeie6

Jetzt: Windows abfrage:
"Do you want to install MSOffice2003"?
Yes
No
(No standard) 10s Anwortzeit, sonst weiter mit "No"

(dazu sollte jederzeit ein Button mit "Abort" sein. Das Button wird das Befehl
"wineserver -k" haben.
Jedesmal dass die Installation scheitert/abgebrochen wird: nochmalige frage:
"Installation of Trados failed. Do you wish to try once more"
Yes
No
(Standard).
Wenn yes, dann kommt man wieder zu ~/.wine/drive_c und startet erneut "wine SDLTrados2007_PRO_SP2_835.exe"

cd ~/.wine/drive_c
wine SDLTrados2007_PRO_SP2_835.exe

Dann wird der Installshield gestartet. Es wird automatisch durchgeführt, man git jedoch den Benutzer bei jedes Fragefenster 10s Zeit, sich für etwas anders zu entscheiden, bevor man die Standardeingabe wählt/nein sagt.

Man sollte die Option [read] usen.
Wenn einer der Optionen [weiter/continue] ist, sollte es nach 10s durchgeführt werden.
Wenn Antwort [ja/yes] oder [no/nein], nach 10 Sekunden [no/nein]
Wenn bei der Lizenz [Annehmen/Accept] / [Ablehnen/reject], dann sollte der Radiobutton (wenn bereits auf Anblehnen gesetzt] auf annehmen gesetzt (in der Regel eine Möglichkeit vorher] und dann auf [weiter/continue] sobald die Funktion aktiviert wird.
Wenn automatisch (keine Nutzereingabe wärhend 10 s), werden optionale Felder nicht gefüllt, Ratio buttons nicht gefüllt etc -> es werden die standard eingaben genommen.
Beim ersten automatischen Launch, ersten Fenster, ersten Link, zweiten Fenster, ersten Link dann automatisch genommen was geboten wird. Beim 2. Lauf (installation ist von selbst als erfolgreich beendet), automatischen Launch, ersten Fenster 2. Link, manuelles restart, ersten Fenster ersten Link, zweiten Fenster, ersten Link.
Bei der Lizenzieren sollte es auf [trial version] gesetzt werden (ich muss noch die Namen der Ratio-Buttons anschauen).

Falls die Installation nach mehr als 40 min noch nicht abgeschlossen (timeout), wird es abgebrochen (wineserver -k) man wird gefragt ob man restarten will, Ja/nein, nach 10s ohne Antwort script enden.

Wenn alles beendet wird, wird log in ~/.wine/drive_c gespeichert. Laufende Numerierung wennn mehrere logs.

Please take into account that I can't code so the examples I give are surely not functional.
Dan Kegel

Writing an automated install script

Post by Dan Kegel »

2008/4/6 Timeout <[email protected]>:
Here my first instructions
Looks great for a start. That's the kind of detail us Wine developers love.

In this section:
Prüfen, ob die nachfolgende dlls sich in ./wine/drive_c/windows/system32, wenn nicht (oder welche die fehlen)
cp ~/trados-installation/fusion.dll, mfc42.dll, msvcr70.dll,secur32.dll ~/.wine/drive_c/windows/system32
cd ~/.wine/drive_c/windows/system32
wine regsvr32.exe msvcr70.dll
wine regsvr32.exe fusion.dll
wine regsvr32.exe mfc42.dll
wine regsvr32.exe secur32.dll
where are those dlls coming from -- did you copy them there from
a Windows installation? If so, can you replace the lines
wine regsvr32.exe msvcr70.dll
wine regsvr32.exe mfc42.dll
with
winetricks vcrun6 vcrun2003
?
winetricks corefonts gecko wsh56js fakeie6
Great, but you may as well use winetricks' -q flag so user
doesn't have to click so much.
Jetzt: Windows abfrage:
"Do you want to install MSOffice2003"?
Why install Office 2003? Is that required to use Trados? If so, maybe
just do it no matter what.
Jedesmal dass die Installation scheitert/abgebrochen wird: nochmalige frage:
"Installation of Trados failed. Do you wish to try once more"
If you're providing this script for Wine developers, we
don't need any sort of "do you want to retry" option.
Dann wird der Installshield gestartet. Es wird automatisch durchgeführt, man git jedoch den Benutzer bei jedes Fragefenster 10s Zeit, sich für etwas anders zu entscheiden, bevor man die Standardeingabe wählt/nein sagt.
Again, if this is for Wine developers, we don't need that level of comfort.
But if you really want to do this, the language to write that part
of the script in is probably autohotkey.
- Dan
Timeout
Level 4
Level 4
Posts: 183
Joined: Sat Feb 23, 2008 12:45 pm

Re: Writing an automated install script

Post by Timeout »

In this section:
where are those dlls coming from -- did you copy them there from
a Windows installation? If so, can you replace the lines
wine regsvr32.exe msvcr70.dll
wine regsvr32.exe mfc42.dll
with
winetricks vcrun6 vcrun2003
?
vcrun 2003 is installing msvcr71, which is not quite the same. I guess an empty file would do as well, it's just for the registration of fusion.dll.
Later on all my logs msvcr80 or msvcp 80 are rather used.
I take them from my Windows on dual booting.
Jetzt: Windows abfrage:
Why install Office 2003? Is that required to use Trados? If so, maybe
just do it no matter what.
Msoffice 2003 (or 2007 when it's working) are quite necessary.
First in trados for the conversion of texts using Workbench. Any processing of files other than .ttx and .rtf are using Word in the background to transform the file to process it to rtf.

SDLX is using Word in the background to convert any file (except rtf) to SDLX own's format (idf if I remember) and only then you will be able to process the file.

Word (when it will be working properly) is enabling you to have a spell check which is crucial for a translator. Furthermore, Trados is said not only to use VBA, but even word's own script format.

Using Open Office instead of Word on Trados is on the wish list of Trados' users but it's not likely to happen any time soon since from the point of view of SDL, OpenOffice is changing too often and even less documented than Word to base their software on it. Seems to be too much work to adapt the macros after every update.
If you're providing this script for Wine developers, we
don't need any sort of "do you want to retry" option.
I know. But I won't get the script if I don't plan for my own use. And I know as long as it's not 100% perfect that I may have to intervene myself to get it installed. Seing from the point of view of my husband (I don't pay by the hour so I can ask for it to be more comfortable) - He has to be half of the night next week because of an update of his company and even watching TV is boring him at that time so I know I can ask more.
My goal is to use it as end user too - that way I could also send the script to my colleagues.
Dan Kegel

Writing an automated install script

Post by Dan Kegel »

On Sun, Apr 6, 2008 at 9:05 AM, Timeout <[email protected]> wrote:
vcrun 2003 is installing msvcr71, [not msvcr70]. ... it's just for the registration of fusion.dll.
Oh, right. I'll see if I can implement a vcrun2002 verb in crosstool.
Later on all my logs msvcr80 or msvcp 80 are rather used.
I take them from my Windows on dual booting.
Can you please use 'winetricks vcrun2005' instead of grabbing from windows?
My goal is to use it as end user too - that way I could also send the script to my colleagues.
I see.

You might want to skip the interactive parts of your script and go
straight to a noninteractive install of everything. Trados documentation
for earlier versions said you could install it noninteractively like this:
msiexec.exe /i "<CompletePathTo'Trados.msi'>" /qn
Does that work with your version?

You might want to use the ideas in
http://wpkg.org/MS_Office_2003
to offer a silent install rather than an interactive one for Office 2003.
- Dan
Timeout
Level 4
Level 4
Posts: 183
Joined: Sat Feb 23, 2008 12:45 pm

Re: Writing an automated install script

Post by Timeout »

Dan Kegel wrote: Can you please use 'winetricks vcrun2005' instead of grabbing from windows?
vcrun2005 is already part of Trados's installer. I don't need a winetrick for that.
You might want to skip the interactive parts of your script and go
straight to a noninteractive install of everything. Trados documentation
for earlier versions said you could install it noninteractively like this:
msiexec.exe /i "<CompletePathTo'Trados.msi'>" /qn
Does that work with your version?
I heard someone did with cabextract to extract the trados.msi and started it so.
It's however more complicated as an user to have to search for which of the 7 or 8 pieces installed by the installshield can be independently used from one another.
At least more for me than showing each of the windows and writing what to enter in which window.
Since SDL bought Trados, it's slowly but surely merging the functions of one into another. I guess the last trados to be independent from SDLX was 7.0 - won't be supported for long anyway since SDL announced they won't be supporting versions more than 3 years old and thus removed version 6.5 out of support.
You might want to use the ideas in
http://wpkg.org/MS_Office_2003
to offer a silent install rather than an interactive one for Office 2003.
To test the installer I don't need office. I will probably remove it at the moment. It's installing as it is at the moment anyway-
Timeout
Level 4
Level 4
Posts: 183
Joined: Sat Feb 23, 2008 12:45 pm

Post by Timeout »

Here for you the windows we have to go through to make a full install (I think I may be missing the screenshot of synergy install completed but I think that it's the least of the problem - if it's working, the rest is working too).

http://www.uebersetzen.at/Wine/Trados-screenshot/
Dan Kegel

Writing an automated install script

Post by Dan Kegel »

On Mon, Apr 7, 2008 at 12:56 AM, Timeout <[email protected]> wrote:
Can you please use 'winetricks vcrun2005' instead of grabbing from windows?
vcrun2005 is already part of Trados's installer. I don't need a winetrick for that.
Then why did you write
Later on all my logs msvcr80 or msvcp 80 are rather used.
I take them from my Windows on dual booting.
? Those two DLLs are installed by 'winetricks vcrun2005', and
shouldn't need to be copied from Windows.
You might want to skip the interactive parts of your script and go
straight to a noninteractive install of everything. Trados documentation
for earlier versions said you could install it noninteractively like this:
msiexec.exe /i "<CompletePathTo'Trados.msi'>" /qn
Does that work with your version?
I heard someone did with cabextract to extract the trados.msi and started it so.
It's however more complicated as an user to have to search for which of
the 7 or 8 pieces installed by the installshield can be independently used from one another.
Why would the user have to search for anything? The documentation
I read (http://www.sml.hw.ac.uk/computing/docum ... _TM_en.pdf)
said that adding /qn to the msiexec did a complete installation of the entire
suite.
- Dan
Timeout
Level 4
Level 4
Posts: 183
Joined: Sat Feb 23, 2008 12:45 pm

Re: Writing an automated install script

Post by Timeout »

Why would the user have to search for anything? The documentation
I read (http://www.sml.hw.ac.uk/computing/docum ... _TM_en.pdf)
said that adding /qn to the msiexec did a complete installation of the entire
suite.
Does it mean I should write "wine tradosinstall.exe /qn "

This will reduce the script pretty much.

(I am not manually adding the msvcr80, I just said I have to add msvcr70, although I can see in the logs that msvcr80 is mainly used)
Timeout
Level 4
Level 4
Posts: 183
Joined: Sat Feb 23, 2008 12:45 pm

Re: Writing an automated install script

Post by Timeout »

Why would the user have to search for anything? The documentation
I read (http://www.sml.hw.ac.uk/computing/docum ... _TM_en.pdf)
said that adding /qn to the msiexec did a complete installation of the entire
suite.
The problem is too that it's the description for Trados before SDL bought it (seems to be 6.x-7) - I have an old CD and it looks like the same.
The installer did look more simple at that time, it was installing only 1 software.
Timeout
Level 4
Level 4
Posts: 183
Joined: Sat Feb 23, 2008 12:45 pm

Post by Timeout »

Script for today:

I am trying to make the script for myself so that I can learn.

Some parts are still missing, some obviously incorrect.

Code: Select all

#!/bin/sh

# requires that the necessary files are in a directory "trados-installation" in home

$ wineprefixcreate
$ cp ~/trados-installation/SDLTrados2007_PRO_SP2_835.exe ~/.wine/drive_c/


$ cp ~/trados-installation/fusion.dll, msvcr70.dll,secur32.dll ~/.wine/drive_c/windows/system32

#If file already there -> skip

$ cd ~/.wine/drive_c/windows/system32
wine regsvr32.exe msvcr70.dll
wine regsvr32.exe fusion.dll
wine regsvr32.exe secur32.dll

$ cd ../../../


$ wget www.kegel.com/winetricks
winetricks -q corefonts gecko wsh56js fakeie6 vcrun6

$ cd ~/.wine/drive_c
$ wine SDLTrados2007_PRO_SP2_835.exe&>log.txt

# Screenshot 1
if [ $button = "Next" ] then select "Next"

# Screenshot 2a
if [ $button = "No to all" ] then select "No to all"

# Screenshot 4
if [ $link = "Installation Software" ] then select "Installation Software"

# Screenshot 5

if [ $link = "Installation Software" ] and [ "$link" = "Install SDL FLEXlm License server" ] and [ $loop = 1] select "Installation Software"

if [ $link = " Installation Software" ] and [ "$link" = "Install SDL FLEXlm License server" ] and [ $loop = 2] select "Install SDL FLEXlm License server"

# Screenshot 6

if [ $button = "Install" ] then select "Install"

# Screenshot 7

if [ $button = "No" ] then select "No"

# Screenshot 8

if [ $button = "Annehmen" ] then select "Annehmen"

# Screenshot 10

if read = "I accept the terms in the license agreement" and  read = " I do not accept the terms in the license agreement"  then select "I accept the terms in the license agreement" 

# Screenshot 11

if read = "User name"  then echo =  "test"

if read = "Organisation" then echo = "test" and select [ $button = "Next" ]



1. I don't know yet to check if something is already there.
2. What I call loop is the second run of the same page, I have yet to look what is the variable for it
3. Screenshot 11, I may have the problem that "Next" gets clicked to early since I have already told to click on next. How to make the script understand that "next" is to be clicked only after these entries.
Do I have to say to the other "next" that's only when no other command are pending?
Dan Kegel

Writing an automated install script

Post by Dan Kegel »

On Mon, Apr 7, 2008 at 10:59 AM, Timeout <[email protected]> wrote:
1. I don't know yet to check if something is already there.
if [ test -f filename ]
then
echo "file exists"
fi
3. Screenshot 11, I may have the problem that "Next" gets clicked to early since I have already told to click on next. How to make the script understand that "next" is to be clicked only after these entries.
Do I have to say to the other "next" that's only when no other command are pending?
You can't click buttons in a shell script. Are you expecting the user to
do all the button clicking, or do you want to automate that?
Timeout
Level 4
Level 4
Posts: 183
Joined: Sat Feb 23, 2008 12:45 pm

Re: Writing an automated install script

Post by Timeout »

if [ test -f filename ]
then
echo "file exists"
fi
Thank you. I will add it for each dll to add manually.

You can't click buttons in a shell script. Are you expecting the user to
do all the button clicking, or do you want to automate that?
I want to automate that so that like your valgrin test, you can enter the script test list and get at the end a log where you can see if a change is improving or breaking the installer. Every part which fails has a message that the component failed so answering no there would abort the installation and you see what failed and for the case it hangs I would like to add a timeout.

In a later stage, I will try to give some time to the user to select at each window before the script comes into force.
Timeout
Level 4
Level 4
Posts: 183
Joined: Sat Feb 23, 2008 12:45 pm

Post by Timeout »

New script with interesting output:

Code: Select all

#!/bin/sh

# requires that the necessary files are in a directory "trados-installation" in home

wineprefixcreate
cp ~/trados-installation/SDLTrados2007_PRO_SP2_835.exe ~/.wine/drive_c/

cd ~/.wine/drive_c/windows/system32


if test -f msvcr70.dll
then
echo "file exists"
else
	cp ~/trados-installation/msvcr70.dll ~/.wine/drive_c/windows/system32
	wine regsvr32.exe msvcr70.dll
fi

if test -f fusion.dll
then
echo "file exists"
else
	cp ~/trados-installation/fusion.dll ~/.wine/drive_c/windows/system32 
	wine regsvr32.exe fusion.dll
fi

if test -f secur32.dll
then
echo "file exists"
else
	cp ~/trados-installation/secur32.dll ~/.wine/drive_c/windows/system32
	wine regsvr32.exe secur32.dll
fi



cd ../../../


wget www.kegel.com/winetricks
winetricks -q corefonts gecko wsh56js fakeie6 vcrun6

declare -x $loop1[=wine SDLTrados2007_PRO_SP2_835.exe&>log1.txt]
declare -x $loop2=[wine SDLTrados2007_PRO_SP2_835.exe&>log2.txt]

cd ~/.wine/drive_c

$loop1
{

# Screenshot 2a
if $button = "No to all"
then select $button [="No to all"]
fi


# Screenshot 4
if $link="Installation Software"
then select $link="Installation Software"
fi


# Screenshot 5

if	$link="Install SDL Trados 2007" 
then select $link="Install SDL Trados 2007"
fi

# Screenshot 6

if 	$button="Install" 
then select $button="Install"
fi 


# Screenshot 7

if read "Failed to install Microsoft .NET Framework 2.0. Continue with other components" 
then echo ".NET2 INSTALL FAILS!" && select $button="Yes"
fi


# Screenshot 8

if 	$button="Annehmen"
then select $button="Annehmen"
fi

# Screenshot 10

if read "I accept the terms in the license agreement" | "I do not accept the terms in the license agreement"  
then select "I accept the terms in the license agreement" 
fi

# Screenshot 11

if read = "User name"  then echo =  "test"
fi
if read = "Organisation" then echo = "test" && select $button = "Next"
fi


# Screenshot 1 als letzes Eingeben!
if $button="Next"
then select $button="Next"
fi

fi 
}

if [ test -f trados.exe ]
then


{
wine $loop2


#Screenshot 5
if $link ="Install SDL FLEXlm License server"
then select $link ="Install SDL FLEXlm License server"
fi

}

else
exit
Now to the interesting part:
It's not launching the installation yet, but I'm not far.
The script is not yet distinguishing the prompting of the wine installation with all other if and throwing me error because of the if (I have to find out why).
The interesting thing is that all winetricks and steps before are working, so if you go to drive_c and launch the installer of Trados, you start directly with the installation of the .NET2, throwing you a couple of exceptions like the ones I've seen later on Trados.
Tested on 0.9.59.
Timeout
Level 4
Level 4
Posts: 183
Joined: Sat Feb 23, 2008 12:45 pm

Post by Timeout »

Ok that's as far as I can get:

Code: Select all

#!/bin/sh

# requires that the necessary files are in a directory "trados-installation" in home - "trados-installation directory must contain the trados installation file, currently msvcr70.dll, fusion.dll and secur32.dll (not for long).
# To launch the script, install Wine, save this script as filename.sh, make a directory with the needed files and enter in the console: $ sh filename.sh.

wineprefixcreate

cd ~/.wine/drive_c/
if test -f SDLTrados2007_PRO_SP2_835.exe
then
echo "file exists"
else
cp ~/trados-installation/SDLTrados2007_PRO_SP2_835.exe ~/.wine/drive_c/
fi

cd ~/.wine/drive_c/windows/system32
if test -f msvcr70.dll
then
echo "file exists"
else
cp ~/trados-installation/msvcr70.dll ~/.wine/drive_c/windows/system32
wine regsvr32.exe msvcr70.dll
fi

if test -f fusion.dll
then
echo "file exists"
else
	cp ~/trados-installation/fusion.dll ~/.wine/drive_c/windows/system32 
	wine regsvr32.exe fusion.dll
fi

if test -f secur32.dll
then
echo "file exists"
else
	cp ~/trados-installation/secur32.dll ~/.wine/drive_c/windows/system32
	wine regsvr32.exe secur32.dll
fi



cd ../../../


wget -nd www.kegel.com/wine/winetricks
winetricks -q corefonts gecko vcrun6 wsh56 fakeie6  vcrun2005 msxml4 winver=winxp

cd ~/.wine/drive_c

wine SDLTrados2007_PRO_SP2_835.exe 


exit
That's enough for somebody not used to the console to start the installation of Trados.
To get further, I have to find some button pushing script (it's working perfectly manually) or find some instructions about it, for which I do not have much the time at the moment. I must however add that the installer's progress was better on 0.9.58 than on 0.9.59.

I did try to do cabextract to isolate the individual files but it did not work and did not bring me to the goal of a silent install.
Trados is complaining in this case that this update (although the full installation file) is only for installer version of the SP1 or the previous version and for earlier versions I should contact SDL.
Locked