Seite 1 von 1
[SOLVED] Several reboots during script execution
Verfasst: 24 Jan 2013, 09:00
von bobzbobz
Hi
I want to package F-secure antivirus.
How should i handle several reboots during script execution.
The package needs to reboot during both installation and uninstallation.
I would probably just set the command:
at the end of the setup-script, and at the end of the delsub-script.
But what happens if the package is installed on a client and someone chooses the option to install (setup).
Then it runs the setup untill the sub-script delsub is called, and then it reboots when the delsub-script is run through, but does OPSI continue the setup-script after the reboot?
Its hard to explain, but let me know if i need to be more specific.
What i want:
Code: Alles auswählen
Setup.ins
|
Delsub.ins (uninstall product)
|
Reboot (when product is uninstalled)
|
Setup.ins (continue new installation)
|
Reboot (when product is installed)
Re: Several reboots during script execution
Verfasst: 24 Jan 2013, 09:05
von tobias
you must set a reboot flag via Winst.
http://download.uib.de/opsi4.0/doc/html ... nds-reboot
reboot with ExitWindows /ImmediateReboot
Re: Several reboots during script execution
Verfasst: 12 Feb 2013, 10:43
von bobzbobz
Hi
Im still not sure on how to do this if i need to reboot several times.
My current code is:
Code: Alles auswählen
DefVar $MsiId$
DefVar $LogDir$
DefVar $ProductId$
DefVar $MinimumSpace$
DefVar $InstallDir$
DefVar $ExitCode$
DefVar $LicenseRequired$
DefVar $LicenseKey$
DefVar $LicensePool$
DefVar $Flag1$
DefVar $Flag2$
DefVar $WinstRegKey$
Set $LogDir$ = "%SystemDrive%\tmp"
Set $WinstRegKey$ = "HKLM\SOFTWARE\opsi.org\winst"
Set $Flag1$ = GetRegistryStringValue("["+$WinstRegKey$+"] "+"RebootFlag1")
Set $Flag2$ = GetRegistryStringValue("["+$WinstRegKey$+"] "+"RebootFlag2")
; ----------------------------------------------------------------
Set $ProductId$ = "fsecureclient"
Set $MinimumSpace$ = "1 GB"
Set $LicenseRequired$ = "false"
Set $LicensePool$ = "p_" + $ProductId$
; ----------------------------------------------------------------
if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
LogError "Der er ikke nok plads paa %SystemDrive%, " + $MinimumSpace$ + " paa drev %SystemDrive% skal bruges til " + $ProductId$
isFatalError "Ikke nok plads"
; Stop processen og angiv installationsstatus som fejlet
else
comment "Vis produktlogo"
ShowBitmap "%ScriptPath%\fsecurelogo.png" $ProductId$
comment "Tjek om program er afinstalleret"
if not ($Flag1$="1")
Message "Starter afinstallation"
if FileExists("%ScriptPath%\delsub32.ins")
comment "Start uninstall sub section"
Sub "%ScriptPath%\delsub32.ins"
endif
comment "Markerer at afinstallationen er udført, og genstarter"
Set $Flag1$="1"
Registry_SaveRebootFlag1
comment "Genstarter efter afinstallation under setup"
ExitWindows /ImmediateReboot
endif
Message "Installerer " + $ProductId$ + " ..."
comment "Tjekker om programmet er installeret"
if not ($Flag2$="1")
if $LicenseRequired$ = "true"
comment "Licens skal bruges, reserver og hent licens"
Sub_get_licensekey
endif
Message "Starter installation"
comment "Start setup-program"
ChangeDirectory "%SCRIPTPATH%"
Winbatch_install /WaitForProcessEnding "fssetup.exe"
Sub_check_exitcode
comment "Markerer at programmet er installeret, når der genstartes"
Set $Flag2$="1"
Registry_SaveRebootFlag2
comment "Genstarter efter installation"
ExitWindows /ImmediateReboot
else
Message "Installation færdig - sætter flag til 0"
Set $Flag1$="0"
Set $Flag2$="0"
Registry_SaveRebootFlag1
Registry_SaveRebootFlag2
endif
endif
[Winbatch_install]
msiexec /i "%ScriptPath%\fsecureclient.msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=1 REBOOT=ReallySuppress
[Registry_SaveRebootFlag1]
openKey [$WinstRegKey$]
set "RebootFlag1" = "$Flag1$"
[Registry_SaveRebootFlag2]
openKey [$WinstRegKey$]
set "RebootFlag2" = "$Flag2$"
But it doesnt work - is it not possible to create several rebootflags?
Re: Several reboots during script execution
Verfasst: 12 Feb 2013, 14:31
von tobias
please post your logfile
Re: Several reboots during script execution
Verfasst: 12 Feb 2013, 15:02
von bobzbobz
It works now..
I deleted the scripts, and started over.
My current code is:
Code: Alles auswählen
[Actions]
requiredWinstVersion >= "4.11.2.6"
DefVar $MsiId$
DefVar $UninstallProgram$
DefVar $LogDir$
DefVar $ProductId$
DefVar $MinimumSpace$
DefVar $InstallDir$
DefVar $ExitCode$
DefVar $LicenseRequired$
DefVar $LicenseKey$
DefVar $LicensePool$
DefVar $RebootFlag$
DefVar $WinstRegKey$
Set $LogDir$ = "%SystemDrive%\tmp"
Set $WinstRegKey$ = "HKLM\SOFTWARE\opsi.org\winst"
Set $RebootFlag$ = GetRegistryStringValue("["+$WinstRegKey$+"] "+"RebootFlag")
; ----------------------------------------------------------------
Set $ProductId$ = "fsecureclient"
Set $MinimumSpace$ = "1 GB"
Set $LicenseRequired$ = "false"
Set $LicensePool$ = "p_" + $ProductId$
; ----------------------------------------------------------------
if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
LogError "Der er ikke nok plads paa %SystemDrive%, " + $MinimumSpace$ + " paa drev %SystemDrive% skal bruges til " + $ProductId$
isFatalError "Ikke nok plads"
; Stop processen og angiv installationsstatus som fejlet
else
comment "Vis produktlogo"
ShowBitmap "%ScriptPath%\fsecurelogo.png" $ProductId$
if not (($RebootFlag$ = "1") or ($RebootFlag$ = "2"))
comment "Rebootflag sættes til 1 (sektionen er aktiveret)"
Set $RebootFlag$ = "1"
Registry_SaveRebootFlag /32Bit
if FileExists("%ScriptPath%\delsub32.ins")
comment "Start uninstall sub section"
Sub "%ScriptPath%\delsub32.ins"
endif
endif
if ($RebootFlag$ = "1")
Message "Installerer " + $ProductId$ + " ..."
if $LicenseRequired$ = "true"
comment "Licens skal bruges, reserver og hent licens"
Sub_get_licensekey
endif
comment "Start setup-program"
ChangeDirectory "%SCRIPTPATH%"
Winbatch_install /WaitForProcessEnding "fssetup.exe"
; Sub_check_exitcode
comment "Rebootflag sættes til 2 (installation udført)"
Set $RebootFlag$ = "2"
Registry_SaveRebootFlag /32Bit
ExitWindows /ImmediateReboot
else
Set $RebootFlag$ = "0"
Registry_SaveRebootFlag /32Bit
endif
endif
[Winbatch_install]
msiexec /i "%ScriptPath%\fsecureclient.msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=1 REBOOT=ReallySuppress
[Registry_SaveRebootFlag]
openKey [$WinstRegKey$]
set "RebootFlag" = "$RebootFlag$"