system directories (SOLVED)

Antworten
goudeuk
Beiträge: 27
Registriert: 13 Sep 2016, 16:53

system directories (SOLVED)

Beitrag von goudeuk »

Hello

I'm in the process of writing my first script and I'm looking at the thunderbird script shown here:

wiki/doku.php?id=userspace:mozilla_thunderbird

My question is why variable %ScriptPath% is not set anywhere?

Are all System directories [W]: not required to be set?

For example do I have to set %ProgramFiles32Dir%? I don't see being set on other scripts available online.
Learning winbatch is painful. :|

Thank you
Zuletzt geändert von goudeuk am 05 Apr 2017, 10:59, insgesamt 1-mal geändert.
nicolaslebrun
Beiträge: 107
Registriert: 18 Apr 2011, 11:43

Re: system directories

Beitrag von nicolaslebrun »

Winst is not so painfull...

All variables between % (%variable%) are winst variables...

We use most of the time :
- %ProgramFiles32Dir% that is c:\Program Files(x86) if you're on 64bits architecture
- %ProgramFilesSysnativeDir% that is c:\Program Files on 32 and 64 bits architecture.

And this is quite well documented here (but i hope you allready know) : http://download.uib.de/opsi4.0/doc/html ... anual.html

Regards,

Nico
Benutzeravatar
ngbr
Ex-uib-Team
Beiträge: 130
Registriert: 27 Sep 2010, 11:41

Re: system directories

Beitrag von ngbr »

Hi goudeuk,

when trying to understand scripts, look at the template we provide in /var/lib/opsi/depot/opsi-template/install.opsiscript .

you need to do not much except for tweaking the ID in the head of the script, and then uncomment some of what you wanna do. Delete the rest.

You can skip the annoying part of finding out about the installer being used by the software by using opsi-setup-detector. this will give you working (un)install scripts for most of the software you need on a windows machine. Even they are not very nicely readable.. sorry about this.

opsi-setup-detector can be easily installed via a working opsi system - we provide the product. so after installing the agent onto a windows machine, you can deploy opsi-setup-detector by setting the product to setup.

if there are questions about the process or using the software, keep asking ;)
if you want to use 'opsi-package-builder' later, there is a special are for that at the bottom of the forum viewforum.php?f=22 , where you can find the installables. Its not a bad idea tho to try to understand how the scripts work first.

also the opsi-winst-reference-card can make your life easier here : http://download.uib.de/opsi4.0/doc/html ... -card.html

cheers Andre
---
hoping to help :)

if your problem was solved, pls mark this thread as 'SOLVED'. thank you .

-- no PN support --

Andre
goudeuk
Beiträge: 27
Registriert: 13 Sep 2016, 16:53

Re: system directories

Beitrag von goudeuk »

Yes I have links to all the manuals and the winst reference card, thanks Nico.
I got confused because in some scripts, variables are being used without being defined and I got confused.

For example:

Code: Alles auswählen

%ProgramFilesDir%: c:\program files
%ProgramFiles32Dir%: c:\Program Files (x86) //since 4.10.8
%ProgramFiles64Dir%: c:\program files //since 4.10.8
%ProgramFilesSysnativeDir% : c:\program files //since 4.10.8
%Systemroot% : c:\windows
%System% : c:\windows\system32
%Systemdrive% : c:
So the above variables winst already knows about them and there is no need to set them? I can just go ahead and use them without doing:

Code: Alles auswählen

set %System% = "c:\windows\system32"
Thank you Andre for letting me know about opsi-setup-detector and the install.opsiscript template. I am going to check them out today.
Benutzeravatar
n.wenselowski
Ex-uib-Team
Beiträge: 3194
Registriert: 04 Apr 2013, 12:15

Re: system directories

Beitrag von n.wenselowski »

Hi,

these global constants represent the state of the system during the runtime of the winst.
You do not need to set them manually. (I don't know if it would even be possible to manually set them to be honest.)
You can and should use them in your scripts instead of hardcoding paths as they allow you to create scripts that are runnable on a wide array of different systems.


Kind regards

Niko

Code: Alles auswählen

import OPSI
goudeuk
Beiträge: 27
Registriert: 13 Sep 2016, 16:53

Re: system directories

Beitrag von goudeuk »

Thank you Niko
Antworten