[gelöst] Putty als opsi Paket verteilen funktioniert nicht

Antworten
cdis
Beiträge: 9
Registriert: 29 Jun 2020, 22:08

[gelöst] Putty als opsi Paket verteilen funktioniert nicht

Beitrag von cdis »

Hallo zusammen,

ich habe meine ersten Pakete mit Opsi erstellt und verteilt, nun wollte ich putty per Opsi verteilen und renne da in ein Problem.
Entweder bin ich schon Betriebsblind und sehe den Fehler im Script nicht, oder Putty lässt sich einfach mit Opsi nicht verteilen.

Ich habe als Erstes getestet, ob das Original-MSI sich von einer Shell aus installieren lässt --> okay, funktioniert
Als Zweites habe ich das setup.ins Script über opsi-winst ausgetestet --> das wirft 1 Errors und 9 Warnings.
Am Ende ist Putty trotzdem installiert und funktioniert.
Als Nächstes habe ich das uninstall.ins Script über opsi-winst ausgetestet --> dieses wirft 0 Errors und 4 Warnings,
doch die Deinstallation ist einwandfrei erfolgt.

In einer Remoteshell habe ich dann zunächst opsi-newprod ausgeführt, dann die Sourcen in CLIENT_DATA abgelegt,
opsi-makepackage ausgeführt, ins Stammverzeichnis gewechselt und dann mittels opsi-package-manager --install putty_0.74-1.opsi
das Paket auf den Server geschoben.

Bis hierher lief alles ohne Probleme. Als ich dann das Paket on-demand zur Verteilung brachte, lief auf dem Zielsystem der Opsi-Agent an,
und anstatt zu installieren, zog er die Deinstallation an!?
Ich finde den Fehler nicht, hat jemand von Euch eine Idee, was passiert sein könnte?

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

[Actions]
requiredWinstVersion >= "4.11.4.6"
ScriptErrorMessages=off

DefVar $MsiId$
DefVar $UninstallProgram$
DefVar $LogDir$
DefVar $ProductId$
DefVar $MinimumSpace$
DefVar $InstallDir$
DefVar $ExitCode$
DefVar $LicenseRequired$
DefVar $LicenseKey$
DefVar $LicensePool$
DefVar $displayName32$
DefVar $displayName64$

DefStringlist $msilist$

Set $LogDir$ = "%opsiLogDir%"

; ----------------------------------------------------------------
; - Please edit the following values -
; ----------------------------------------------------------------
;$ProductId$ should be the name of the product in opsi
; therefore please: only lower letters, no umlauts,
; no white space use '-' as a seperator
Set $ProductId$ = "putty"
Set $MinimumSpace$ = "1 MB"
; the path were we find the product after the installation
Set $InstallDir$ = "%ProgramFiles32Dir%\putty"
Set $LicenseRequired$ = "false"
Set $LicensePool$ = "p_" + $ProductId$
; ----------------------------------------------------------------

if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
isFatalError "No Space"
; Stop process and set installation status to failed
else
comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$

if FileExists("%ScriptPath%\delsub32.opsiscript")
comment "Start uninstall sub section"
Sub "%ScriptPath%\delsub32.opsiscript"
endif

Message "Installing " + $ProductId$ + " ..."

if $LicenseRequired$ = "true"
comment "Licensing required, reserve license and get license key"
Sub_get_licensekey
endif

comment "Start setup program"
ChangeDirectory "%SCRIPTPATH%"
Winbatch_install
Sub_check_exitcode

comment "Copy files"
Files_install /32Bit

comment "Patch Registry"
Registry_install /32Bit

comment "Create shortcuts"
LinkFolder_install

endif

[Winbatch_install]
; Choose one of the following examples as basis for your installation
; You can use $LicenseKey$ var to pass a license key to the installer
;
; === Nullsoft Scriptable Install System ================================================================
; "%ScriptPath%\Setup.exe" /S
;
; === MSI package =======================================================================================
; You may use the parameter PIDKEY=$Licensekey$
msiexec /i "%ScriptPath%\putty-64bit-0.74-installer.msi" /liweamo "$LogDir$\$ProductId$.install_log.txt" /qn ALLUSERS=1 REBOOT=ReallySuppress
;
; === InstallShield + MSI=====================================================================================
; Attention: The path to the log file should not contain any whitespaces
; "%ScriptPath%\setup.exe" /s /v" /l* $LogDir$\$ProductId$.install_log.txt /qb-! ALLUSERS=1 REBOOT=ReallySuppress"
; "%ScriptPath%\setup.exe" /s /v" /qb-! ALLUSERS=1 REBOOT=ReallySuppress"
;
; === InstallShield =====================================================================================
; Create setup.iss answer file by running: setup.exe /r /f1"c:\setup.iss"
; You may use an answer file by the parameter /f1"c:\setup.iss"
; "%ScriptPath%\setup.exe" /s /sms /f2"$LogDir$\$ProductId$.install_log.txt"
;
; === Inno Setup ========================================================================================
; http://unattended.sourceforge.net/InnoS ... Codes.html
; You may create setup answer file by: setup.exe /SAVEINF="filename"
; You may use an answer file by the parameter /LOADINF="filename"
; "%ScriptPath%\setup.exe" /sp- /silent /norestart /nocancel /SUPPRESSMSGBOXES

[Files_install]
; Example of recursively copying some files into the installation directory:
;
; copy -s "%ScriptPath%\files\*.*" "$InstallDir$"

[Registry_install]
; Example of setting some values of an registry key:
;
; openkey [HKEY_LOCAL_MACHINE\Software\$ProductId$]
; set "name1" = "some string value"
; set "name2" = REG_DWORD:0001
; set "name3" = REG_BINARY:00 af 99 cd

[LinkFolder_install]
; Example of deleting a folder from AllUsers startmenu:
;
; set_basefolder common_programs
; delete_subfolder $ProductId$
;
; Example of creating an shortcut to the installed exe in AllUsers startmenu:
;
; set_basefolder common_programs
; set_subfolder $ProductId$
;
; set_link
; name: $ProductId$
; target: <path to the program>
; parameters:
; working_dir: $InstallDir$
; icon_file:
; icon_index:
; end_link
;
; Example of creating an shortcut to the installed exe on AllUsers desktop:
;
; set_basefolder common_desktopdirectory
; set_subfolder ""
;
; set_link
; name: $ProductId$
; target: <path to the program>
; parameters: <some_param>
; working_dir: $InstallDir$
; icon_file: <path to icon file>
; icon_index: 2
; end_link

[Sub_get_licensekey]
if opsiLicenseManagementEnabled
comment "License management is enabled and will be used"

comment "Trying to get a license key"
Set $LicenseKey$ = demandLicenseKey ($LicensePool$)
; If there is an assignment of exactly one licensepool to the product the following call is possible:
; Set $LicenseKey$ = demandLicenseKey ("", $ProductId$)
;
; If there is an assignment of a license pool to a windows software id, it is possible to use:
; DefVar $WindowsSoftwareId$
; $WindowsSoftwareId$ = "..."
; Set $LicenseKey$ = demandLicenseKey ("", "", $WindowsSoftwareId$)

DefVar $ServiceErrorClass$
set $ServiceErrorClass$ = getLastServiceErrorClass
comment "Error class: " + $ServiceErrorClass$

if $ServiceErrorClass$ = "None"
comment "Everything fine, we got the license key '" + $LicenseKey$ + "'"
else
if $ServiceErrorClass$ = "LicenseConfigurationError"
LogError "Fatal: license configuration must be corrected"
LogError getLastServiceErrorMessage
isFatalError
else
if $ServiceErrorClass$ = "LicenseMissingError"
LogError "Fatal: required license is not supplied"
isFatalError
endif
endif
endif
else
LogError "Fatal: license required, but license management not enabled"
isFatalError
endif


[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 ... S.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
Zuletzt geändert von cdis am 22 Sep 2021, 18:09, insgesamt 1-mal geändert.
thomas.besser
Beiträge: 461
Registriert: 09 Sep 2009, 09:40

Re: Putty als opsi Paket verteilen funktioniert nicht

Beitrag von thomas.besser »

cdis hat geschrieben: Bis hierher lief alles ohne Probleme. Als ich dann das Paket on-demand zur Verteilung brachte, lief auf dem Zielsystem der Opsi-Agent an,
und anstatt zu installieren, zog er die Deinstallation an!?
Ich finde den Fehler nicht, hat jemand von Euch eine Idee, was passiert sein könnte?
Also meine Glaskugel ist aktuell in Reparatur ;)

Wirft das Skript einen Fehler? Was sagt das Logfile zum entsprechenden Skript?

Gruß
Thomas
Jan.Schmidt
Beiträge: 439
Registriert: 08 Jul 2017, 12:02

Re: Putty als opsi Paket verteilen funktioniert nicht

Beitrag von Jan.Schmidt »

Hi,
Thomas:

ich hab hier das Glasauge von Peter Falk zur Wartung und schielt eindeutig hierhin:

Code: Alles auswählen

[Winbatch_install]
msiexec /i "%ScriptPath%\putty-64bit-0.74-installer.msi" /liweamo "$LogDir$\$ProductId$.install_log.txt" /qn 
winbatch_install mit 64bit msiexec schreit irgendwie nach

Code: Alles auswählen

Winbatch_Install /Sysnative
Benutzeravatar
ThomasT
uib-Team
Beiträge: 538
Registriert: 26 Jun 2013, 12:26

Re: Putty als opsi Paket verteilen funktioniert nicht

Beitrag von ThomasT »

Code: Alles auswählen

if FileExists("%ScriptPath%\delsub32.opsiscript")
comment "Start uninstall sub section"
Sub "%ScriptPath%\delsub32.opsiscript"
endif
Damit wird vor der Installation eine Deinstallation gestartet...ist Standardverhalten im opsi-template...
Kein Support per DM!
_________________________
opsi support - https://www.uib.de/
For productive opsi installations we recommend support contracts.
cdis
Beiträge: 9
Registriert: 29 Jun 2020, 22:08

Re: Putty als opsi Paket verteilen funktioniert nicht

Beitrag von cdis »

ThomasT hat geschrieben:

Code: Alles auswählen

if FileExists("%ScriptPath%\delsub32.opsiscript")
comment "Start uninstall sub section"
Sub "%ScriptPath%\delsub32.opsiscript"
endif
Damit wird vor der Installation eine Deinstallation gestartet...ist Standardverhalten im opsi-template...
Okay, das habe ich mir inzwischen, nach genauerem durchgehen des Skriptes auch so zusammengereimt. Es wird quasi anstelle einer Reparatur, das Paket neu zur Installation gebracht und damit das funktioniert, räumt der Wrapper vorher die alte Installation weg.

Danke! Dann bleibt nur noch die Frage, weshalb das Skript nicht weitermacht.
Ich schaue mir das nochmal genauer an. An manchen Stellen musste ich mehrfach lesen, bis ich verstand, was da genau passiert.
Was mir auffiel, als ich das Original vom Putty MSI genauer unter die Lupe nahm war, dass da anscheinen ein Innosetup, in dem MSI verschachtelt, vorliegt.
Jan.Schmidt
Beiträge: 439
Registriert: 08 Jul 2017, 12:02

Re: Putty als opsi Paket verteilen funktioniert nicht

Beitrag von Jan.Schmidt »

Hi,

1. ALLLES was mit ; beginnt ist ein Kommentar
2. Alles, was das script macht, steht im script logfile auf dem client - schau dir das einfach mal an
3. Wenn da nix steht, schraub den loglevel höher
4. Bei nächsten mal code blöcke anstatt quote for das script nutzen
5. Viel Spass
6. Bleib gesund
cdis
Beiträge: 9
Registriert: 29 Jun 2020, 22:08

Re: Putty als opsi Paket verteilen funktioniert nicht

Beitrag von cdis »

Jan.Schmidt hat geschrieben:Hi,
Thomas:

ich hab hier das Glasauge von Peter Falk zur Wartung und schielt eindeutig hierhin:

Code: Alles auswählen

[Winbatch_install]
msiexec /i "%ScriptPath%\putty-64bit-0.74-installer.msi" /liweamo "$LogDir$\$ProductId$.install_log.txt" /qn 
winbatch_install mit 64bit msiexec schreit irgendwie nach

Code: Alles auswählen

Winbatch_Install /Sysnative
Vielen Dank für den Hinweis, ich hatte tatsächlich die falsche Source gegriffen und eingebunden.
Mit der 32bit Variante klappte dann auch die Installation. :roll:
Das sind diese Momente, wo ich mir wieder vor Augen halten muss, dass schnell nicht immer gut ist.
Manchmal sollte man einfach genauer hinsehen und einen Gang zurückschalten.

Probiere es nun auch noch mit einem für die 64bit Variante angepassten Script.
cdis
Beiträge: 9
Registriert: 29 Jun 2020, 22:08

Re: Putty als opsi Paket verteilen funktioniert nicht

Beitrag von cdis »

Jan.Schmidt hat geschrieben:Hi,

1. ALLLES was mit ; beginnt ist ein Kommentar
2. Alles, was das script macht, steht im script logfile auf dem client - schau dir das einfach mal an
3. Wenn da nix steht, schraub den loglevel höher
4. Bei nächsten mal code blöcke anstatt quote for das script nutzen
5. Viel Spass
6. Bleib gesund
Hab den Fehler dank des Hinweises auf die 64bit beseitigen können.
Vielen Dank nochmals.

Den Spass an OPSI habe ich gefunden :D
Ich sage dann jetzt mal "gute Nacht" und bleib auch Du gesund

==> Eine Frage noch ... wie kann ich das Thema auf gelöst setzen?
Benutzeravatar
SisterOfMercy
Beiträge: 1523
Registriert: 22 Jun 2012, 19:18

Re: Putty als opsi Paket verteilen funktioniert nicht

Beitrag von SisterOfMercy »

cdis hat geschrieben:Okay, das habe ich mir inzwischen, nach genauerem durchgehen des Skriptes auch so zusammengereimt. Es wird quasi anstelle einer Reparatur, das Paket neu zur Installation gebracht und damit das funktioniert, räumt der Wrapper vorher die alte Installation weg.
If it looks like the install is repairing the installation, then maybe you have not finished the uninstall section first?

If the msi is just a wrapper for an innosetup installer, why not extract the innosetup installer? This works just as good as a msi installer. Or, if you just need putty and not the rest, why not just copy some files (just the 32-bit and 64-bit putty.exe files)?

Code: Alles auswählen

[Actions]
requiredWinstVersion >= "4.11.5.14"

DefVar $LogDir$
DefVar $ProductId$  
DefVar $MinimumSpace$
DefVar $InstallDir32$
DefVar $InstallDir64$
DefVar $ExitCode$
DefVar $INST_SystemType$
DefVar $INST_MsVersion$

DefStringList $ProductInfo$
DefVar $DisplayVersion$
DefVar $DisplayName$
set $ProductInfo$ = getProductMap
set $DisplayVersion$ = getValue("productversion", $ProductInfo$)
set $DisplayName$ = getValue("name", $ProductInfo$)

set $INST_MsVersion$ = GetMsVersionInfo
Set $INST_SystemType$ = GetSystemType
Set $LogDir$ = "%opsiLogDir%"

; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
;$ProductId$ should be the name of the product in opsi
; therefore please: only lower letters, no umlauts, 
; no white space use '-' as a seperator
Set $ProductId$       = "putty"
Set $MinimumSpace$    = "500 MB"
; the path were we find the product after the installation
Set $InstallDir32$      = "%ProgramFiles32Dir%\PuTTY"
Set $InstallDir64$      = "%ProgramFiles64Dir%\PuTTY"
; ----------------------------------------------------------------

if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
	LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
	isFatalError
	; Stop process and set installation status to failed
endif
if CompareDotSeparatedNumbers($INST_MsVersion$, "<", "5.1")
	LogError "Windows XP or newer is required for " + $ProductId$  
	isFatalError
endif
	
comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$

if FileExists("%ScriptPath%\delsub3264.opsiscript")
	comment "Start uninstall sub section"
	Sub "%ScriptPath%\delsub3264.opsiscript"
endif
	
comment "installing"

if ($INST_SystemType$ = "x86 System") 
	Message "Installing " + $ProductId$ + "..."
	comment "Copy files"
	Files_install_32 /32Bit
	comment "Patch Registry"
	Registry_install_32 /32Bit
	Registry_install_AllProfiles /AllNTUserDats
endif

if ($INST_SystemType$ = "64 Bit System") 
	Message "Installing " + $ProductId$ + "..."
	comment "Copy files"
	Files_install_64 /64Bit
	comment "Patch Registry"
	Registry_install_64 /64Bit
	Registry_install_AllProfiles /AllNTUserDats
endif

[Files_install_32]
copy -s "%ScriptPath%\files\x86\*" "$InstallDir32$"

[Files_install_64]
copy -s "%ScriptPath%\files\x64\*" "$InstallDir64$"

[Registry_install_32]
openkey [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$ProductId$]
set "Comments" = "Installed with OPSI"
set "DisplayIcon" = "$InstallDir32$\putty.exe"
set "DisplayVersion" = "$DisplayVersion$"
set "NoModify" = REG_DWORD:00000001
set "NoRepair" = REG_DWORD:00000001
set "NoRemove" = REG_DWORD:00000001
set "Publisher" = "Simon Tatham"
set "DisplayName" = "$DisplayName$ $DisplayVersion$"
set "UninstallString" = "$InstallDir32$\putty.exe"
set "InstallLocation" = "$InstallDir32$"

[Registry_install_64]
openkey [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$ProductId$]
set "Comments" = "Installed with OPSI"
set "DisplayIcon" = "$InstallDir64$\putty.exe"
set "DisplayVersion" = "$DisplayVersion$"
set "NoModify" = REG_DWORD:00000001
set "NoRepair" = REG_DWORD:00000001
set "NoRemove" = REG_DWORD:00000001
set "Publisher" = "Simon Tatham"
set "DisplayName" = "$DisplayName$ $DisplayVersion$"
set "UninstallString" = "$InstallDir64$\putty.exe"
set "InstallLocation" = "$InstallDir64$"

[Registry_install_AllProfiles]
openkey [HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\Default%20Settings]
set "HostName" = ""
set "TerminalType" = "putty"
set "Beep" = REG_DWORD:00000000
set "ScrollbackLines" = REG_DWORD:0x0003d090
set "TermWidth" = REG_DWORD:0x0000007d
set "TermHeight" = REG_DWORD:0x00000028
set "MouseIsXterm" = REG_DWORD:00000002
;set "ScrollOnDisp" = REG_DWORD:00000000

; Remove stored start menu order
deletekey [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start Menu]
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
Antworten