[1026] | 1 | ; Copyright (c) uib gmbh (www.uib.de)
|
---|
| 2 | ; This sourcecode is owned by uib
|
---|
| 3 | ; and published under the Terms of the General Public License.
|
---|
| 4 | ; credits: http://www.opsi.org/en/credits/
|
---|
| 5 |
|
---|
| 6 | [Actions]
|
---|
| 7 | requiredWinstVersion >= "4.10.8.6"
|
---|
| 8 |
|
---|
| 9 | DefVar $MsiId32$
|
---|
| 10 | DefVar $UninstallProgram32$
|
---|
| 11 | DefVar $MsiId64$
|
---|
| 12 | DefVar $UninstallProgram64$
|
---|
| 13 | DefVar $LogDir$
|
---|
| 14 | DefVar $ProductId$
|
---|
| 15 | DefVar $MinimumSpace$
|
---|
| 16 | DefVar $InstallDir32$
|
---|
| 17 | DefVar $InstallDir64$
|
---|
| 18 | DefVar $ExitCode$
|
---|
| 19 | DefVar $LicenseRequired$
|
---|
| 20 | DefVar $LicenseKey$
|
---|
| 21 | DefVar $LicensePool$
|
---|
| 22 | DefVar $INST_SystemType$
|
---|
| 23 | DefVar $INST_architecture$
|
---|
| 24 |
|
---|
| 25 | Set $INST_SystemType$ = GetSystemType
|
---|
| 26 | set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
|
---|
| 27 |
|
---|
| 28 |
|
---|
| 29 | Set $LogDir$ = "%SystemDrive%\tmp"
|
---|
| 30 |
|
---|
| 31 | ; ----------------------------------------------------------------
|
---|
| 32 | ; - Please edit the following values -
|
---|
| 33 | ; ----------------------------------------------------------------
|
---|
| 34 | ;$ProductId$ should be the name of the product in opsi
|
---|
| 35 | ; therefore please: only lower letters, no umlauts,
|
---|
| 36 | ; no white space use '-' as a seperator
|
---|
| 37 | Set $ProductId$ = "virtualbox-guest-tools"
|
---|
| 38 | Set $MinimumSpace$ = "10 MB"
|
---|
| 39 | ; the path were we find the product after the installation
|
---|
| 40 | Set $InstallDir32$ = "%ProgramFiles32Dir%\Oracle\VirtualBox Guest Additions"
|
---|
| 41 | Set $InstallDir64$ = "%ProgramFiles64Dir%\Oracle\VirtualBox Guest Additions"
|
---|
| 42 | Set $LicenseRequired$ = "false"
|
---|
| 43 | Set $LicensePool$ = "p_" + $ProductId$
|
---|
| 44 | ; ----------------------------------------------------------------
|
---|
| 45 |
|
---|
| 46 | if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
|
---|
| 47 | LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
|
---|
| 48 | isFatalError
|
---|
| 49 | ; Stop process and set installation status to failed
|
---|
| 50 | else
|
---|
| 51 | comment "Show product picture"
|
---|
| 52 | ShowBitmap "%ScriptPath%\logo.png" $ProductId$
|
---|
| 53 |
|
---|
| 54 | ;if FileExists("%ScriptPath%\delsub3264.ins")
|
---|
| 55 | ; comment "Start uninstall sub section"
|
---|
| 56 | ; Sub "%ScriptPath%\delsub3264.ins"
|
---|
| 57 | ;endif
|
---|
| 58 |
|
---|
| 59 | ;if $LicenseRequired$ = "true"
|
---|
| 60 | ; comment "Licensing required, reserve license and get license key"
|
---|
| 61 | ; Sub_get_licensekey
|
---|
| 62 | ;endif
|
---|
| 63 |
|
---|
| 64 | comment "installing"
|
---|
| 65 |
|
---|
| 66 | if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
|
---|
| 67 | Message "Installing " + $ProductId$ + " 32 Bit..."
|
---|
| 68 | comment "Start setup program"
|
---|
| 69 | Winbatch_install_32
|
---|
| 70 | Sub_check_exitcode
|
---|
| 71 | ;comment "Copy files"
|
---|
| 72 | ;Files_install_32 /32Bit
|
---|
| 73 | ;comment "Patch Registry"
|
---|
| 74 | ;Registry_install /32Bit
|
---|
| 75 | ;comment "Create shortcuts"
|
---|
| 76 | ;LinkFolder_install
|
---|
| 77 | endif
|
---|
| 78 |
|
---|
| 79 | if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
|
---|
| 80 | Message "Installing " + $ProductId$ + " 64 Bit..."
|
---|
| 81 | comment "Start setup program"
|
---|
| 82 | Winbatch_install_64
|
---|
| 83 | Sub_check_exitcode
|
---|
| 84 | ;comment "Copy files"
|
---|
| 85 | ;Files_install_64 /64Bit
|
---|
| 86 | ;comment "Patch Registry"
|
---|
| 87 | ;Registry_install /64Bit
|
---|
| 88 | ;comment "Create shortcuts"
|
---|
| 89 | ;LinkFolder_install
|
---|
| 90 | endif
|
---|
| 91 |
|
---|
| 92 | endif
|
---|
| 93 |
|
---|
| 94 | [Winbatch_install_32]
|
---|
| 95 | ; more options, see /?
|
---|
| 96 | "%ScriptPath%\data\VBoxWindowsAdditions-x86.exe" /S
|
---|
| 97 |
|
---|
| 98 | [Winbatch_install_64]
|
---|
| 99 | "%ScriptPath%\data\VBoxWindowsAdditions-amd64.exe" /S
|
---|
| 100 |
|
---|
| 101 |
|
---|
| 102 | [Files_install_32]
|
---|
| 103 | ; Example of recursively copying some files into the installation directory:
|
---|
| 104 | ;
|
---|
| 105 | ; copy -s "%ScriptPath%\files\*.*" "$InstallDir32$"
|
---|
| 106 |
|
---|
| 107 | [Files_install_64]
|
---|
| 108 | ; Example of recursively copying some files into the installation directory:
|
---|
| 109 | ;
|
---|
| 110 | ; copy -s "%ScriptPath%\files\*.*" "$InstallDir64$"
|
---|
| 111 |
|
---|
| 112 | [Registry_install]
|
---|
| 113 | ; Example of setting some values of an registry key:
|
---|
| 114 | ;
|
---|
| 115 | ; openkey [HKEY_LOCAL_MACHINE\Software\$ProductId$]
|
---|
| 116 | ; set "name1" = "some string value"
|
---|
| 117 | ; set "name2" = REG_DWORD:0001
|
---|
| 118 | ; set "name3" = REG_BINARY:00 af 99 cd
|
---|
| 119 |
|
---|
| 120 | [LinkFolder_install]
|
---|
| 121 | ; Example of deleting a folder from AllUsers startmenu:
|
---|
| 122 | ;
|
---|
| 123 | ; set_basefolder common_programs
|
---|
| 124 | ; delete_subfolder $ProductId$
|
---|
| 125 | ;
|
---|
| 126 | ; Example of creating an shortcut to the installed exe in AllUsers startmenu:
|
---|
| 127 | ;
|
---|
| 128 | ; set_basefolder common_programs
|
---|
| 129 | ; set_subfolder $ProductId$
|
---|
| 130 | ;
|
---|
| 131 | ; set_link
|
---|
| 132 | ; name: $ProductId$
|
---|
| 133 | ; target: <path to the program>
|
---|
| 134 | ; parameters:
|
---|
| 135 | ; working_dir: $InstallDir$
|
---|
| 136 | ; icon_file:
|
---|
| 137 | ; icon_index:
|
---|
| 138 | ; end_link
|
---|
| 139 | ;
|
---|
| 140 | ; Example of creating an shortcut to the installed exe on AllUsers desktop:
|
---|
| 141 | ;
|
---|
| 142 | ; set_basefolder common_desktopdirectory
|
---|
| 143 | ; set_subfolder ""
|
---|
| 144 | ;
|
---|
| 145 | ; set_link
|
---|
| 146 | ; name: $ProductId$
|
---|
| 147 | ; target: <path to the program>
|
---|
| 148 | ; parameters: <some_param>
|
---|
| 149 | ; working_dir: $InstallDir$
|
---|
| 150 | ; icon_file: <path to icon file>
|
---|
| 151 | ; icon_index: 2
|
---|
| 152 | ; end_link
|
---|
| 153 |
|
---|
| 154 | [Sub_get_licensekey]
|
---|
| 155 | comment "License management is enabled and will be used"
|
---|
| 156 |
|
---|
| 157 | comment "Trying to get a license key"
|
---|
| 158 | Set $LicenseKey$ = demandLicenseKey ($LicensePool$)
|
---|
| 159 | ; If there is an assignment of exactly one licensepool to the product the following call is possible:
|
---|
| 160 | ; Set $LicenseKey$ = demandLicenseKey ("", $ProductId$)
|
---|
| 161 | ;
|
---|
| 162 | ; If there is an assignment of a license pool to a windows software id, it is possible to use:
|
---|
| 163 | ; DefVar $WindowsSoftwareId$
|
---|
| 164 | ; $WindowsSoftwareId$ = "..."
|
---|
| 165 | ; Set $LicenseKey$ = demandLicenseKey ("", "", $WindowsSoftwareId$)
|
---|
| 166 |
|
---|
| 167 | DefVar $ServiceErrorClass$
|
---|
| 168 | set $ServiceErrorClass$ = getLastServiceErrorClass
|
---|
| 169 | comment "Error class: " + $ServiceErrorClass$
|
---|
| 170 |
|
---|
| 171 | if $ServiceErrorClass$ = "None"
|
---|
| 172 | comment "Everything fine, we got the license key '" + $LicenseKey$ + "'"
|
---|
| 173 | else
|
---|
| 174 | if $ServiceErrorClass$ = "LicenseConfigurationError"
|
---|
| 175 | LogError "Fatal: license configuration must be corrected"
|
---|
| 176 | LogError getLastServiceErrorMessage
|
---|
| 177 | isFatalError
|
---|
| 178 | else
|
---|
| 179 | if $ServiceErrorClass$ = "LicenseMissingError"
|
---|
| 180 | LogError "Fatal: required license is not supplied"
|
---|
| 181 | isFatalError
|
---|
| 182 | endif
|
---|
| 183 | endif
|
---|
| 184 | endif
|
---|
| 185 |
|
---|
| 186 | [Sub_check_exitcode]
|
---|
| 187 | comment "Test for installation success via exit code"
|
---|
| 188 | set $ExitCode$ = getLastExitCode
|
---|
| 189 | ; informations to exit codes see
|
---|
| 190 | ; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
|
---|
| 191 | ; http://msdn.microsoft.com/en-us/library/aa368542.aspx
|
---|
| 192 | if ($ExitCode$ = "0")
|
---|
| 193 | comment "Looks good: setup program gives exitcode zero"
|
---|
| 194 | else
|
---|
| 195 | comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
|
---|
| 196 | if ($ExitCode$ = "1605")
|
---|
| 197 | comment "ERROR_UNKNOWN_PRODUCT 1605 This action is only valid for products that are currently installed."
|
---|
| 198 | comment "Uninstall of a not installed product failed - no problem"
|
---|
| 199 | else
|
---|
| 200 | if ($ExitCode$ = "1641")
|
---|
| 201 | comment "looks good: setup program gives exitcode 1641"
|
---|
| 202 | comment "ERROR_SUCCESS_REBOOT_INITIATED 1641 The installer has initiated a restart. This message is indicative of a success."
|
---|
| 203 | else
|
---|
| 204 | if ($ExitCode$ = "3010")
|
---|
| 205 | comment "looks good: setup program gives exitcode 3010"
|
---|
| 206 | comment "ERROR_SUCCESS_REBOOT_REQUIRED 3010 A restart is required to complete the install. This message is indicative of a success."
|
---|
| 207 | else
|
---|
| 208 | logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
|
---|
| 209 | isFatalError
|
---|
| 210 | endif
|
---|
| 211 | endif
|
---|
| 212 | endif
|
---|
| 213 | endif
|
---|
| 214 |
|
---|