User Tools

Site Tools


userspace:f-secure_workstation

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
userspace:f-secure_workstation [2013/10/24 08:42]
bobzbobz
userspace:f-secure_workstation [2013/10/24 09:51]
bobzbobz
Line 1: Line 1:
 ====== F-Secure Workstation (Exported from Management Console) ====== ====== F-Secure Workstation (Exported from Management Console) ======
-//Scripts and Guide by Soren Birk. Credits to forum-user [[https://forum.opsi.org/memberlist.php?mode=viewprofile&u=7125|aellert]] for idea for opsi.ini-file.//+//Scripts and Guide by Soren Birk. Credits to forum-user [[https://forum.opsi.org/memberlist.php?mode=viewprofile&u=7125|aellert]] for the idea to the opsi.ini-file.// 
 + 
 +This package installs F-Secure Workstation.  
 + 
 +Since updates are critical to an Anti-Virus, a ini-file is created to keep track of older Msi ID's.\\ When the package needs to be updated, simply replace the Msi-ID to match the new msi-file, and update the version number in the control-file. 
 + 
 +//Please note that I am refering to major releases, as definition-updates should come from the Management Server automatically.//
  
 **Tested With:** **Tested With:**
Line 10: Line 16:
   * Start off by creating a policy that matches your company's needs from F-Secure Policy Manager Console.   * Start off by creating a policy that matches your company's needs from F-Secure Policy Manager Console.
   * Bind this policy to the Workstation-package and export it as a .msi-file.   * Bind this policy to the Workstation-package and export it as a .msi-file.
 +
 +**Tree:**
 +<code>
 +CLIENT_DATA
 +  ├ setup.ins
 +  ├ uninstall.ins
 +  ├ delsub.ins
 +  ├ fsecurelogo.png
 +  └ wworkstationsXXXX-exported.msi
 +</code>
 +
 +//Use Microsoft Orca to get the msi ID for the setup- and uninstall-script.//
 +
 +==== setup.ins ====
 +<code winst>
 +; Author Soren Birk
 +
 +[Actions]
 +requiredWinstVersion >= "4.11.2.6"
 +
 +DefVar $MsiId$
 +DefVar $old_MsiId$
 +DefVar $OpsiIni$
 +DefVar $LogDir$
 +DefVar $ProductId$
 +DefVar $MinimumSpace$
 +DefVar $InstallDir$
 +DefVar $ExitCode$
 +
 +; Determines if an uninstall has been run during execution of setup-script
 +DefVar $UninstHasBeenRun$
 +Set $UninstHasBeenRun$ = "false"
 +
 +Set $OpsiIni$         = $InstallDir$ + "\opsi.ini"
 +Set $old_MsiId$       = GetValueFromInifile($OpsiIni$,"version","msiid","")
 +
 +Set $MsiId$ = '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}'
 +
 +Set $LogDir$ = "%SystemDrive%\tmp"
 +
 +; ----------------------------------------------------------------
 +; - Please edit the following values                             -
 +; ----------------------------------------------------------------
 +Set $ProductId$       = "fsecurews"
 +Set $MinimumSpace$    = "1 GB"
 +Set $InstallDir$      = "%ProgramFiles32Dir%\F-Secure"
 +; ----------------------------------------------------------------
 +
 +if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
 + LogError "Not enough free space on %SystemDrive%, " + $MinimumSpace$ + " on the drive %SystemDrive% is needed for " + $ProductId$
 + isFatalError "Not enough free space"
 + ; Stop the process and set installationstatus as failed
 +else
 +
 + comment "Show product logo"
 + ShowBitmap "%ScriptPath%\fsecurelogo.png" "F-Secure Workstation Antivirus"
 +
 + if FileExists("%ScriptPath%\delsub.ins")
 + comment "Start uninstall sub section"
 + Sub "%ScriptPath%\delsub.ins"
 +
 + if $UninstHasBeenRun$ = "true"
 + Set $UninstHasBeenRun$ = "false"
 + ExitWindows /ImmediateReboot
 + endif
 + endif
 +
 + Message "Starting installation"
 +
 + comment "Start setup-program"
 + ChangeDirectory "%SCRIPTPATH%"
 + Winbatch_install
 + Sub_check_exitcode
 +
 + comment "Create/update opsi.ini"
 + Patches_majversion $InstallDir$+"\opsi.ini"
 +
 + ExitWindows /Reboot
 +endif
 +
 +
 +[Winbatch_install]
 +msiexec /i "%ScriptPath%\wworkstationsXXXX-exported.msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=1 REBOOT=ReallySuppress
 +
 +[Patches_majversion]
 +set [version] msiid=$MsiId$
 +
 +[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
 +</code>
 +
 +==== uninstall.ins ====
 +<code winst>
 +; Author Soren Birk
 +
 +[Actions]
 +requiredWinstVersion >= "4.11.2.6"
 +
 +DefVar $MsiId$
 +DefVar $old_MsiId$
 +DefVar $OpsiIni$
 +DefVar $LogDir$
 +DefVar $ExitCode$
 +DefVar $ProductId$
 +DefVar $InstallDir$
 +DefVar $UninstHasBeenRun$
 +
 +Set $LogDir$ = "%SystemDrive%\tmp"
 +
 +Set $OpsiIni$         = $InstallDir$ + "\opsi.ini"
 +Set $old_MsiId$       = GetValueFromInifile($OpsiIni$,"version","msiid","")
 +
 +Set $MsiId$ = '{{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}'
 +
 +; ----------------------------------------------------------------
 +; - Please edit the following values                             -
 +; ----------------------------------------------------------------
 +Set $ProductId$       = "fsecurews"
 +Set $InstallDir$      = "%ProgramFiles32Dir%\F-Secure"
 +; ----------------------------------------------------------------
 +
 +
 +comment "Show product logo"
 +ShowBitmap "%ScriptPath%\fsecurelogo.png" "F-Secure Workstation Antivirus"
 +
 +Message "Uninstalling " + $ProductId$ + " ..."
 +
 +if FileExists("%ScriptPath%\delsub.ins")
 + comment "Start uninstall sub section"
 + Sub "%ScriptPath%\delsub.ins"
 +
 + ExitWindows /Reboot
 +endif
 +</code>
 +
 +==== delsub.ins ====
 +<code winst>
 +; Author Soren Birk
 +
 +Message "Uninstalling " + $ProductId$ + " ..."
 +
 +if FileExists($OpsiIni$) and not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $old_MsiId$ + "] DisplayName") = "")
 + comment "Old MSI id " + $old_MsiId$ + " found in registry, starting uninstallation"
 + Winbatch_uninstall_oldmsi
 + sub_check_exitcode
 +
 + comment "Remove program folder"
 + Files_uninstall
 +
 + Set $UninstHasBeenRun$ = "true"
 +else
 + if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId$ + "] DisplayName") = "")
 + comment "MSI id " + $MsiId$ + " found in registry, starting uninstallation"
 + Winbatch_uninstall_msi
 + sub_check_exitcode
 +
 + comment "Remove program folder"
 + Files_uninstall
 +
 + Set $UninstHasBeenRun$ = "true"
 + endif
 +endif
 +
 +
 +[Winbatch_uninstall_msi]
 +msiexec /x $MsiId$ /qb! REBOOT=ReallySuppress
 +
 +[Winbatch_uninstall_oldmsi]
 +msiexec /x $old_MsiId$ /qb! REBOOT=ReallySuppress
 +
 +[Files_uninstall]
 +del -sf "$InstallDir$\"
 +
 +[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
 +</code>
userspace/f-secure_workstation.txt · Last modified: 2021/08/23 08:37 (external edit)