Software Installation schlägt Fehl per Remoteinstallation

Starlord
Beiträge: 28
Registriert: 18 Jan 2018, 12:04

Software Installation schlägt Fehl per Remoteinstallation

Beitragvon Starlord » 18 Jan 2018, 12:12

Hallo liebes Forum,

ich bin momentan dabei ein Paket für Serdia zu schreiben. Wenn ich das Paket per opsi-script starte läuft es einwandfrei durch und Funktioniert, jedoch wenn ich das Paket per opsi config editor starte schlägt es fehl und nur ein Teil wird es installiert.
Ich hoffe mir kann jemand helfen :)

Hier noch mein Code:

Code: Alles auswählen

;****************************************
; SETUPTYPE      nsis
;****************************************
; PRODUCTID      setup
; SETUPFILE      setup.exe
;****************************************
; LICENSE        false     
; PRODUCTDESC    setup

; PRODUCTNAME    setup
; PRODUCTSIZE    1500 MB
; PRODUCTVER     10.6.6.0.0
;****************************************
; SETUPSCRIPT    setup.opsiscript
; UNINSSCRIPT    uninstall.opsiscript
;****************************************
; MSIID         
; USE-MST       
; INSTALLDIR     C:\DEUTZ
;****************************************
; TIMESTAMP      16.01.2018 13:41:26
;****************************************

[Actions]
requiredWinstVersion >= "4.11.4.3"
ScriptErrorMessages = false

DefVar $SetupType$
DefVar $ProductId$
DefVar $Setupfile$
DefVar $InstallDir$
DefVar $MinimumSpace$
DefVar $ExitCode$
DefVar $ErrorMsg$
DefVar $LicenseRequired$
DefVar $LicenseKey$
DefVar $LicensePool$
DefVar $MsiId$
DefVar $NsisInstallBatch$
DefVar $LogDir$

Set $LogDir$ = "%opsiLogDir%"

include_append "%ScriptPath%\check_nsis_exitcode.opsiscript"

; ----------------------------------------------------------------
Set $SetupType$       = "nsis"
; ----------------------------------------------------------------

; $ProductId$ is the name of the product in opsi, only lower letters, no umlauts, no white spaces, use '-' as a seperator
Set $ProductId$       = "setup"
Set $Setupfile$       = "setup.exe"
; the path where we find the product after the installation
Set $InstallDir$      = "C:\DEUTZ"
Set $LicenseRequired$ = "false"
Set $LicensePool$     = "p_" + $ProductId$
Set $MsiId$           = ""
Set $MinimumSpace$    = "1500 MB"
; ----------------------------------------------------------------
; ----------------------------------------------------------------

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%\delsub.opsiscript")
      comment "Start uninstall sub section"
      Sub "%ScriptPath%\delsub.opsiscript"
   endif
   
   Message "Installing " + $ProductId$ + " ..."
   
   if $LicenseRequired$ = "true"
      comment "Licensing required, reserve license and get license key"
      Sub_get_licensekey
   endif

   if ($SetupType$ = "nsis")
      Set $NsisInstallBatch$ = "%ScriptPath%\setup.exe /S"
      if not ($InstallDir$ = '')
         Set $NsisInstallBatch$ = $NsisInstallBatch$ + ' /D="' + $InstallDir$ + '"'
      endif
   endif
   
   comment "Start setup program"
 
   ChangeDirectory "%SCRIPTPATH%"
   ;----------------------------------------------
   Winbatch_install_nsis
   ;---------------------------------------------- 
   Sub_check_exitcode   
   endif


; ----------------------------------------------------------------
; install section
; ----------------------------------------------------------------

[Winbatch_install_nsis]
 
$NsisInstallBatch$
 

; ----------------------------------------------------------------


[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$)
 
   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

; ----------------------------------------------------------------
; ----------------------------------------------------------------

uncle_scrooge
Beiträge: 590
Registriert: 21 Feb 2012, 12:03
Wohnort: Mainz

Re: Software Installation schlägt Fehl per Remoteinstallation

Beitragvon uncle_scrooge » 18 Jan 2018, 13:17

Das riecht ziemlich fischig. Aber wenn Motorenbauer Software schreiben (lassen).....

Wenn Du das Script über winst startest, läuft es in Deinem Benutzerkontext.
Wenn es über den lokalen opsi-client gestartet wird, läuft es im Kontext des Benutzers system.
Ich nehme stark an, daß der Installer in das Profil des aufrufenden Benutzers schreiben möchte. Und da hat system nicht viel zu bieten.

Zwei Möglichkeiten:
Den Jungs bei Deutz ein Pittermännchen Päffgen hinstellen, damit sie einen vernünftigen Installer schreiben.
Oder sich mit opsi-template-with-admin auseinandersetzen.

Starlord
Beiträge: 28
Registriert: 18 Jan 2018, 12:04

Re: Software Installation schlägt Fehl per Remoteinstallation

Beitragvon Starlord » 08 Feb 2018, 08:13

Zur Info: Das Problem wurde gelöst. Serdia wollte Daten lokal abspeichern durfte dies aber auf dem Opsi Laufwerk nicht. DIe Lösung war also die setup Dateien Lokal auf dem Rechner zu kopieren und von dort aus per Opsi starten.

Code: Alles auswählen

;****************************************
; SETUPTYPE      nsis
;****************************************
; PRODUCTID      Deutz-Serdia
; SETUPFILE      setup.exe
;****************************************
; LICENSE        false     
; PRODUCTDESC    Deutz Serdia

; PRODUCTNAME    Deutz-Serdia
; PRODUCTSIZE    1500 MB
; PRODUCTVER     10.6.6.0.0
;****************************************
; SETUPSCRIPT    setup.opsiscript
; UNINSSCRIPT    uninstall.opsiscript
;****************************************
; MSIID         
; USE-MST       
; INSTALLDIR     C:\DEUTZ
;****************************************
; TIMESTAMP      16.01.2018 12:19:23
;****************************************

[Actions]
requiredWinstVersion >= "4.11.4.3"
ScriptErrorMessages = false

DefVar $SetupType$
DefVar $ProductId$
DefVar $Setupfile$
DefVar $InstallDir$
DefVar $MinimumSpace$
DefVar $ExitCode$
DefVar $ErrorMsg$
DefVar $LicenseRequired$
DefVar $LicenseKey$
DefVar $LicensePool$
DefVar $MsiId$
DefVar $NsisInstallBatch$
DefVar $LogDir$

Set $LogDir$ = "%opsiLogDir%"

include_append "%ScriptPath%\check_nsis_exitcode.opsiscript"

; ----------------------------------------------------------------
Set $SetupType$       = "nsis"
; ----------------------------------------------------------------

; $ProductId$ is the name of the product in opsi, only lower letters, no umlauts, no white spaces, use '-' as a seperator
Set $ProductId$       = "Deutz-Serdia"
Set $Setupfile$       = "setup.exe"
; the path where we find the product after the installation
Set $InstallDir$      = "C:\DEUTZ"
Set $LicenseRequired$ = "false"
Set $LicensePool$     = "p_" + $ProductId$
Set $MsiId$           = ""
Set $MinimumSpace$    = "1500 MB"
; ----------------------------------------------------------------
; ----------------------------------------------------------------

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%\delsub.opsiscript")
      comment "Start uninstall sub section"
      Sub "%ScriptPath%\delsub.opsiscript"
   endif
   
   Message "Installing " + $ProductId$ + " ..."
   
   if $LicenseRequired$ = "true"
      comment "Licensing required, reserve license and get license key"
      Sub_get_licensekey
   endif

   if ($SetupType$ = "nsis")
      Set $NsisInstallBatch$ = "C:\tmp\serdia\setup.exe /S"
      if not ($InstallDir$ = '')
         Set $NsisInstallBatch$ = $NsisInstallBatch$ + ' /D="' + $InstallDir$ + '"'
      endif
   endif
   
   comment "Start setup program"
   ChangeDirectory "%SCRIPTPATH%"
   ;----------------------------------------------
   Files_copy_serdia
   Winbatch_install_nsis
   Files_delete
   ;----------------------------------------------
   Sub_check_exitcode   
   
endif



; Daten Lokal kopieren in ein TMP Verzeichnis
[Files_Copy_serdia]
copy -se "%scriptpath%\*.*" "c:\tmp\serdia\"


; TMP Daten löschen
[Files_delete]
del -sf c:\tmp\serdia

; ----------------------------------------------------------------
; install section
; ----------------------------------------------------------------

[Winbatch_install_nsis]
;NSIS Nullsoft Scriptable Install System
$NsisInstallBatch$
; ----------------------------------------------------------------


[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

; ----------------------------------------------------------------
; ----------------------------------------------------------------