Seite 1 von 1

Admin-install not rebooting

Verfasst: 02 Mai 2011, 10:38
von Koenraad
Hi,
I made an installer using the admin-user. For some reason when the installation is complete while logged in as admin, it does not reboot. It's the second admin-installer I made and that runs fine. I don't see where I made an error. If I force a reboot after it "hangs" (user interaction is disabled), it terminates without problems, and the software seems successfully installed.

This is the local-setup :

Code: Alles auswählen

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

[Actions]
requiredWinstVersion >= "4.10.5"

DefVar $MsiId$
DefVar $UninstallProgram$
DefVar $LogDir$
DefVar $ProductId$
DefVar $MinimumSpace$
DefVar $InstallDir$
DefVar $ExitCode$
DefVar $LicenseRequired$
DefVar $LicenseKey$
DefVar $LicensePool$
DefVar $ProdInstallFile$
DefVar $ProdVer$

Set $LogDir$ = "%SystemDrive%\tmp"

; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
Set $ProductId$       = "GC-Prevue"
Set $ProdVer$         = "GC-Prevue 19.1.2"
Set $MinimumSpace$    = "8 MB"
; the path were we find the product after the installation
Set $InstallDir$      = "%ProgramFilesDir%\GraphiCode\$ProdVer$"
Set $LicenseRequired$ = "false"
Set $LicensePool$     = "p_" + $ProductId$
Set $MsiId$           = "{FFB61912-3942-4EC0-B7B6-0B32695CB436}"

; ----------------------------------------------------------------
if GetSystemType = "64 Bit System"
 set $ProdInstallFile$ = "GC-Prevue.msi"
 comment "64 bit install"
else
 set $ProdInstallFile$ = "GC-Prevue.msi"
 comment "32 bit install"
endif

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
else
	comment "Show product picture"
	ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
	
	if FileExists("%ScriptPath%\delsub.ins")
		comment "Start uninstall sub section"
		Sub "%ScriptPath%\delsub.ins"
	endif
	
	Message "Installing " + $ProductId$ + " ..."
	
	comment "Start setup program"
	Winbatch_install
	Sub_check_exitcode
	
	comment "Copy files"
	Files_install
	
	comment "Patch Registry"
	Registry_install
	
	comment "Create shortcuts"
	LinkFolder_install
	
	comment "Test for installation success"
	; Test if software marked as installed in registry
	if (GetRegistryStringValue("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$MsiId$] DisplayName") = "")
	 	logError "Fatal: After Installation GC-prevue not found"
	 	isFatalError
	 else
	 	comment "Successful Installation"
	 endif
	comment " rebooting windows "
	ExitWindows /Reboot
	comment " after reboot sent "

endif

[Winbatch_install]
msiexec /i "%ScriptPath%\$ProdInstallFile$" /l* "$LogDir$\$ProductId$.install_log.txt" /qn ALLUSERS=2

[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode
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
Could anycone take a look where I got it wrong ?
If you like I can provide the whole structure of the installer.

Thanks.

Regards,

Koenraad Lelong.

Re: Admin-install not rebooting

Verfasst: 02 Mai 2011, 19:52
von d.oertel
Hi,

have a look at the log. It is possible that the winbatch call ends with a bad exit code which leads to the'isfatalError' statement.
And in this case the script will never execute the 'ExitEindows' statement.
So you have to place a second Reboot call before 'isFatalError'

regards

d.oertel

Re: Admin-install not rebooting

Verfasst: 03 Mai 2011, 08:59
von Koenraad
Hi,

Thanks, after looking in an unexpected file (instlog.bak) on the PC I found why it's not rebooting. Like you suggested, an IsFatalError occured. So how could I trap this ? Should I add a reboot-clause before the IsFatalError, or just after it ? Or is it enough to inculde the statement between the "if" and "else" :

Code: Alles auswählen

if (GetRegistryStringValue("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$MsiId$] DisplayName") = "")
       logError "Fatal: After Installation GC-prevue not found"
       isFatalError
    else
       comment "Successful Installation"
    endif
You say just before, but will the IsFatalError be executed ?
Another question is why I didn't see the problem in the log on the server ?

The software is installed though, so I have to investigate why the test fails.

Thanks again,

Koenraad Lelong.

Re: Admin-install not rebooting

Verfasst: 05 Mai 2011, 21:56
von d.oertel
Hi,

the command

Code: Alles auswählen

ExitWindows /Reboot
means: just reboot after this script is finished.
So you may call this statement as first statement of the script and the script will still be executed completely.

regards

d.oertel

Re: Admin-install not rebooting

Verfasst: 06 Mai 2011, 08:44
von Koenraad
Hi,
For the record. I found why there was no reboot. I messed up the registry-key to test. I tried to include a variable, but I did it wrong.

Code: Alles auswählen

(GetRegistryStringValue("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$MsiId$] DisplayName") = "")
does not work.

Code: Alles auswählen

(GetRegistryStringValue("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"+$MsiId$+"] DisplayName") = "")
does work.

Regards,

Koenraad.