Seite 1 von 1

Einstellen einer Produktabhängigkeit

Verfasst: 09 Jun 2010, 13:18
von eih
Hi,
für das Ausrollen von MS Office 2010 möchte ich gern, dass bei der Installation vorher ein eventuell vorhandenes Office 2000 und der PowerPoint Viewer deinstalliert wird.
Welche Variante führt zum gewünschen Ergebnis?
  • Benötigter Installationsstatus auf not_installed setzten,
  • Bei Auszuführende Aktion uninstalled.
Nun steht im Handbuch
Leider gibt es derzeit nicht wirklich einen generischen Mechanismus für Deinstallations-Produktabhängigkeiten. Zuverlässig ist der ProductDependency-Mechanismus nur für action: setup und die hierbei zu triggernden (before- oder after-) setup Aktionen und installed Status. Ein requiredAction: uninstall führt leider definitiv zu Fehlern.
Welche Möglichkeit habe ich nun, es als Abhängigkeit einzustellen?

Vielen Dank!

Re: Einstellen einer Produktabhängigkeit

Verfasst: 10 Jun 2010, 08:06
von minidump
Du kannst die delsub.ins dafür nutzen. Wenn du das Template des winst Scripts von uib nimmst siehst du, dass die Datei, wenn vorhanden, vor der Installation aufgerufen wird.
In der delsub.ins kannst du dann prüfen, ob eventuell Software installiert ist, die vorher runter muss, z.B. über Pfade. Schau dir mal das Adobe Reader Paket aus dem Download Bereich an, da wird es glaube ich so gemacht.

Re: Einstellen einer Produktabhängigkeit

Verfasst: 10 Jun 2010, 11:51
von eih
Danke,
nun liegt die Deinstallationsskripte in anderen Ordnern.
o2010 ist der Ordner für Office 2010, bei der Installation der aktuelle Ordner.
o2k ist der Ordner für Office 2000, darin liegt das Skript zum Deinstallieren.

Code: Alles auswählen

sub "%ScriptPath%\delo2k.ins"
verweist auf den eigenen Ordner.
Wie spreche ich das Skript im "Nachbarordner" an? Geht das mit

Code: Alles auswählen

sub "%ScriptPath%\..\o2k\delo2k.ins"
Ich möchte ungern Skripte kopieren.

Re: Einstellen einer Produktabhängigkeit

Verfasst: 10 Jun 2010, 12:49
von minidump
Schau dir mal dieses Beispielscript an:

Code: Alles auswählen

**********************************************************************
delsub.ins
**********************************************************************

; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib gmbh
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/credits/

DefVar $MsiId$

Message "Uninstalling Adobe Reader 9 ..."

; Acrobat Reader 9.3 - DEU
Set $MsiId$ = '{AC76BA86-7AD7-1031-7B44-A93000000001}'
if not (GetRegistryStringValue("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId$ + "] DisplayName") = "")
	comment "MSI id " + $MsiId$ + " found in registry, starting msiexec to uninstall"
	Winbatch_uninstall_msi
	sub_check_exitcode
endif

; Acrobat Reader 9.3 - ENU
Set $MsiId$ = '{AC76BA86-7AD7-1033-7B44-A93000000001}'
if not (GetRegistryStringValue("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId$ + "] DisplayName") = "")
	comment "MSI id " + $MsiId$ + " found in registry, starting msiexec to uninstall"
	Winbatch_uninstall_msi
	sub_check_exitcode
endif

; Acrobat Reader 9.2 - DEU
Set $MsiId$ = '{AC76BA86-7AD7-1031-7B44-A92000000001}'
if not (GetRegistryStringValue("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId$ + "] DisplayName") = "")
	comment "MSI id " + $MsiId$ + " found in registry, starting msiexec to uninstall"
	Winbatch_uninstall_msi
	sub_check_exitcode
endif

; Acrobat Reader 9.2 - ENU
Set $MsiId$ = '{AC76BA86-7AD7-1033-7B44-A92000000001}'
if not (GetRegistryStringValue("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId$ + "] DisplayName") = "")
	comment "MSI id " + $MsiId$ + " found in registry, starting msiexec to uninstall"
	Winbatch_uninstall_msi
	sub_check_exitcode
endif

; Acrobat Reader 9.1.3 - DEU
Set $MsiId$ = '{AC76BA86-7AD7-1031-7B44-A91000000001}'
if not (GetRegistryStringValue("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId$ + "] DisplayName") = "")
	comment "MSI id " + $MsiId$ + " found in registry, starting msiexec to uninstall"
	Winbatch_uninstall_msi
	sub_check_exitcode
endif

; Acrobat Reader 9.1.3 - ENU
Set $MsiId$ = '{AC76BA86-7AD7-1033-7B44-A91000000001}'
if not (GetRegistryStringValue("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId$ + "] DisplayName") = "")
	comment "MSI id " + $MsiId$ + " found in registry, starting msiexec to uninstall"
	Winbatch_uninstall_msi
	sub_check_exitcode
endif

[Winbatch_uninstall_msi]
msiexec /x $MsiId$ /qb! REBOOT=ReallySuppress

[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode
; informations to exit codes see
; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
; http://msdn.microsoft.com/en-us/library/aa368542.aspx
if ($ExitCode$ = "0")
	comment "Looks good: setup program gives exitcode zero"
else
	comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
	if ($ExitCode$ = "1605")
		comment "ERROR_UNKNOWN_PRODUCT	1605	This action is only valid for products that are currently installed."
		comment "Uninstall of a not installed product failed - no problem"
	else
		if ($ExitCode$ = "1641")
			comment "looks good: setup program gives exitcode 1641"
			comment "ERROR_SUCCESS_REBOOT_INITIATED	1641	The installer has initiated a restart. This message is indicative of a success."
		else
			if ($ExitCode$ = "3010")
				comment "looks good: setup program gives exitcode 3010"
				comment "ERROR_SUCCESS_REBOOT_REQUIRED	3010	A restart is required to complete the install. This message is indicative of a success."
			else
				logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
				isFatalError
			endif
		endif
	endif
endif
Hier wird geprüft ob ein bestimmter Registry Ky vorhanden ist und dann demetsprechend festgestellt welche Version es ist und diese dann deinstalliert. Steckt alles in einem Script. Im Winst Handbuch findest du den passenden BEfehl wie du feststellen kannst ob ein bestimmter Ordner auf dem Client vorhanden ist um herauszufinden welche Version deinstalliert werden muss.

Re: Einstellen einer Produktabhängigkeit

Verfasst: 10 Jun 2010, 16:14
von romkaM
Deinstallation von älteren Versionen kann MSOffice selbst durchführen.
Dazu muss man bei der Erstellung von unattended Configuration mit dem Setup in Administrationmodus die entsprechende Funktionen aktivieren.
Funktioniert bei uns perfekt.
Bleibt natürlich noch die Frage wie man den entsprechenden Status von alten Produkten in OPSI auf "not installed" setzt.

Re: Einstellen einer Produktabhängigkeit

Verfasst: 14 Jun 2010, 12:31
von matth46
romkaM hat geschrieben:Bleibt natürlich noch die Frage wie man den entsprechenden Status von alten Produkten in OPSI auf "not installed" setzt.
So:

Code: Alles auswählen

comment "Setting <PAKETNAME> to not_installed"
	DefVar $UninstallProductId$
	DefVar $InstallationStatus$
	DefVar $ActionRequest$
	DefVar $ClientId$
	DefVar $DnsDomainName$
	DefStringList $ServiceResult$
	
	Set $UninstallProductId$ = '<PAKETNAME>'
	Set $InstallationStatus$ = 'not_installed'
	Set $ActionRequest$ = 'none'
	Set $ServiceResult$ = getReturnListFromSection('opsiServiceCall_getDomain')
	Set $DnsDomainName$ = takestring(0, $ServiceResult$)
	Set $ClientId$ = lower(EnvVar("COMPUTERNAME")) + "." + $DnsDomainName$
	
	opsiServiceCall_setProductInstallationStatus
	opsiServiceCall_setActionRequestStatus

[opsiServiceCall_getDomain]
"method": "getDomain"
"params": [
          ]

[opsiServiceCall_setProductInstallationStatus]
"method": "setProductInstallationStatus"
"params": [
           "$UninstallProductId$",
           "$ClientId$",
           "$InstallationStatus$"
          ]

[opsiServiceCall_setActionRequestStatus]
"method": "setProductActionRequest"
"params": [
           "$UninstallProductId1$",
           "$ClientId$",
           "$ActionRequest$"
          ]