Registry-Kommande "supp" und Variable

Antworten
bernhardus
Beiträge: 30
Registriert: 02 Apr 2009, 11:25

Registry-Kommande "supp" und Variable

Beitrag von bernhardus »

Hallo,

wenn ich in einer Registry-Sektion das Kommando "set" benutze, kann ich auf vorher definierte Variablen zurückgreifen.
Geht das auch mit dem Kommando "supp"? Daran bin ich nämlich bislang gescheitert...

Beispiel (s. Winst-Handbuch S. 109):

Code: Alles auswählen

DefVar $Path$
DefVar $AddToPath$
set $Path$ = EnvVar ("Path")
set $AddToPath$="c:\orawin\bin"
Registry_PathPatch

[Registry_PathPatch]
openkey [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\control\SessionManager\Environment]
set "Path"="$Path$"
supp "Path"; "$AddToPath$"
Als Ergebnis steht bei mir im Pfad dann
...;$AddToPath$
, d. h. die Variable wurde nicht durch ihren Wert ersetzt. Ich habe auch nocht keinen Weg gefunden, wie ich das bewerkstelligen könnte.

Hintergrund der Aktion ist, daß die Windows-Umgebungsvariable %ProgramFiles% im Pfad nicht expandiert wird (im Gegensatz bspw. zu %SystemRoot%). Da wir mit 32bit und 64bit sowie mit deutschen und englischen Windows-Versionen arbeiten, ist eine Angabe des Programmverzeichnisses als Variable mehr als wünschenswert.
Gruß
Bernd
___________
opsi 4.0.0.18
winst 4.10.8.7
Ubuntu 10.04
Benutzeravatar
d.oertel
uib-Team
Beiträge: 3319
Registriert: 04 Jun 2008, 14:27

Re: Registry-Kommande "supp" und Variable

Beitrag von d.oertel »

Hi,

kann das Problem nicht nachvollziehen.
Vielleicht hilft das Beispiel (leich modifiziert aus dem Produkt opsi-winst-test)
Bei mir gibt der Code:

Code: Alles auswählen

	comment ""
	comment "-------------------------------------"
	comment "Testing: "
	message "Supp"
	set $tmp$="value1;value2;value3"
	Registry_Supp
	set $ConstTest$ = "value;"+$tmp$
	set $CompValue$ = GetRegistryStringValue ("[HKEY_LOCAL_MACHINE\SOFTWARE\opsi.org\opsi-winst-test] test")
	if ($ConstTest$ = $CompValue$)
		comment "passed"
	else
		set $TestResult$ = "not o.k."
		LogWarning "failed"
	endif

[Registry_Supp]
openkey [HKEY_LOCAL_MACHINE\SOFTWARE\opsi.org\opsi-winst-test]
supp "test" ; "$tmp$"
den log:

Code: Alles auswählen

[5] [09.02.2011 18:41:22]   comment: 
[5] [09.02.2011 18:41:22]   comment: -------------------------------------
[5] [09.02.2011 18:41:22]   comment: Testing: 
[5] [09.02.2011 18:41:22]   message Supp
[5] [09.02.2011 18:41:23]   
[5] [09.02.2011 18:41:23]   Set  $tmp$="value1;value2;value3"
[6] [09.02.2011 18:41:23]     The value of the variable "$tmp$" is now: "value1;value2;value3"
[5] [09.02.2011 18:41:23]   
[5] [09.02.2011 18:41:23]   Execution of Registry_Supp
[7] [09.02.2011 18:41:23]     Registry started with redirection (32 Bit)
[7] [09.02.2011 18:41:23]     Key is: HKEY_LOCAL_MACHINE\SOFTWARE\opsi.org\opsi-winst-test
[7] [09.02.2011 18:41:23]     Key0 is: HKEY_LOCAL_MACHINE
[6] [09.02.2011 18:41:23]     Registry key [HKEY_LOCAL_MACHINE\SOFTWARE\opsi.org\opsi-winst-test]  opened
[6] [09.02.2011 18:41:23]         Variable "test"   supplemented with "value1;value2;value3"
[6] [09.02.2011 18:41:23]         Key closed
[5] [09.02.2011 18:41:23]   
[5] [09.02.2011 18:41:23]   Set  $ConstTest$ = "value;"+$tmp$
[6] [09.02.2011 18:41:23]     The value of the variable "$ConstTest$" is now: "value;value1;value2;value3"
[5] [09.02.2011 18:41:23]   
[5] [09.02.2011 18:41:23]   Set  $CompValue$ = GetRegistryStringValue ("[HKEY_LOCAL_MACHINE\SOFTWARE\opsi.org\opsi-winst-test] test")
[7] [09.02.2011 18:41:23]   Registry started with redirection (32 Bit)
[6] [09.02.2011 18:41:23]     Registry key [HKEY_LOCAL_MACHINE\SOFTWARE\opsi.org\opsi-winst-test]  opened
[6] [09.02.2011 18:41:23]     Key closed
[6] [09.02.2011 18:41:23]     The value of the variable "$CompValue$" is now: "value;value1;value2;value3"
[5] [09.02.2011 18:41:23]   
[5] [09.02.2011 18:41:23]   If
[5] [09.02.2011 18:41:23]     $ConstTest$ = $CompValue$   <<< result true
[5] [09.02.2011 18:41:23]     ($ConstTest$ = $CompValue$)   <<< result true
[5] [09.02.2011 18:41:23]   Then
[5] [09.02.2011 18:41:23]     comment: passed
[5] [09.02.2011 18:41:23]   
[5] [09.02.2011 18:41:23]   Else
[5] [09.02.2011 18:41:23]   EndIf
gruss
d.oertel
opsi support - uib gmbh

For productive opsi installations we recommend support contracts.
http://www.uib.de
http://www.opsi.org
bernhardus
Beiträge: 30
Registriert: 02 Apr 2009, 11:25

Re: Registry-Kommande "supp" und Variable

Beitrag von bernhardus »

Hallo,

danke für die schnelle Antwort. Ich werde im Laufe der nächsten Woche das Ganze noch einmal prüfen und melde mich dann wieder.
Gruß
Bernd
___________
opsi 4.0.0.18
winst 4.10.8.7
Ubuntu 10.04
bernhardus
Beiträge: 30
Registriert: 02 Apr 2009, 11:25

Re: Registry-Kommande "supp" und Variable

Beitrag von bernhardus »

Ja, es funktiniert. Warum dsa beim ersten Mal nicht ging kann ich leider nicht mehr nachvollziehen.

Danke nochmals.
Gruß
Bernd
___________
opsi 4.0.0.18
winst 4.10.8.7
Ubuntu 10.04
Antworten