This is an old revision of the document!
Tested with opsi 4.0.4
requiredWinstVersion >= 4.11.3.3
By GEI 2014/09/15 23:10
mRemoteNG ist ein guter OpenSource-Sessionmananager für RDP-, SSH-, VNC-, ICA- und HTTP-Sessions (auch als portable/USB-Version verfügbar).
Vorraussetzung: .NET ab 2.0 Download: http://www.mremoteng.org/download
Tree:
setup.opsiscript
uninstall.opsiscript
delsub.opsiscript
files.usb
; ----------------------------------------------------------------
; Copyright (c) uib gmbh (www.uib.de)
; A Part of this sourcecode is owned by uib
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/en/credits/
; ----------------------------------------------------------------
;**********************************************************************************************************************
; generated by this _great_ tools: opsi-setup-detector & opsi-packetbuilder
; see https://download.uib.de/opsi4.0/experimental/opsi-setup-detector/ & https://forum.opsi.org/viewforum.php?f=22
; SETUPTYPE nsis
;
; modificated by GEI
;**********************************************************************************************************************
[Actions]
requiredWinstVersion >= "4.11.3.3"
ScriptErrorMessages = false
DefVar $SetupType$
DefVar $ProductId$
DefVar $Setupfile$
DefVar $InstallDir$
DefVar $MinimumSpace$
DefVar $ExitCode$
DefVar $ErrorMsg$
DefVar $LicenseRequired$
DefVar $LicenseKey$
DefVar $LicensePool$
DefVar $NsisInstallBatch$
DefVar $LogDir$
DefVar $InstallLanguage$
DefVar $InstallOnUSB$
DefVar $InstallUSBdriveLetter$
DefStringList $OpsiProductMapList$
DefVar $OpsiProductName$
DefVar $OpsiProductVersion$
DefVar $OpsiProductInstalledVersion$
Set $LogDir$ = "%SystemDrive%\opsi.org\log"
; ----------------------------------------------------------------
Set $SetupType$ = "nsis"
; ----------------------------------------------------------------
; new Version:
; please load new .exe into CLIENT_DATA and increment the
; OPSI/control-> package-version & modify product-version
Set $ProductId$ = "mremoteng"
Set $MinimumSpace$ = "8 MB"
; get property from actual opsi packet
Set $OpsiProductMapList$ = getProductMap
Set $OpsiProductName$ = getValue("name",$OpsiProductMapList$)
Set $OpsiProductVersion$ = getValue("productversion",$OpsiProductMapList$)
Set $OpsiProductInstalledVersion$ = getValue("installedversion",$OpsiProductMapList$)
; Pattern + OPSI/Control->Version
Set $Setupfile$ = "mRemoteNG-Installer-" + $OpsiProductVersion$ + ".exe"
Set $InstallDir$ = "%ProgramFiles32Dir%" + "\" + $OpsiProductName$
Set $LicenseRequired$ = "false"
Set $LicensePool$ = "p_" + $ProductId$
; get property values from "OPSI/control" (with default values)
Set $InstallLanguage$ = GetProductProperty("language","system-specific")
Set $InstallOnUSB$ = GetProductProperty("usb","False")
Set $InstallUSBdriveLetter$ = GetProductProperty("usbdriveletter","F:")
; ----------------------------------------------------------------
if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
; Stop process and set installation status to failed
isFatalError "No Space"
else
if (not(FileExists("%ScriptPath%\" + $Setupfile$)))
isFatalError $Setupfile$ + ": not found on %ScriptDrive%, please check OPSI/Control->Version or Setup pattern at setup.ins"
endif
comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $OpsiProductName$
Message "installing new version " + $OpsiProductVersion$ + " ..."
comment "Start setup program on client or usb"
ChangeDirectory "%SCRIPTPATH%"
if ($InstallOnUSB$="False") OR ($InstallUSBdriveLetter$ ="")
comment "no install on usb or no driveletter"
if FileExists("%ScriptPath%\delsub.opsiscript")
comment "Start uninstall sub section"
Message "uninstall old version " + $OpsiProductInstalledVersion$ + " ..."
Sub "%ScriptPath%\delsub.opsiscript"
endif
if $LicenseRequired$ = "true"
comment "Licensing required, reserve license and get license key"
Sub_get_licensekey
endif
if ($SetupType$ = "nsis")
Set $NsisInstallBatch$ = "%ScriptPath%\" + $Setupfile$ + " /S"
if not ($InstallDir$ = '')
Set $NsisInstallBatch$ = $NsisInstallBatch$ + ' /D="' + $InstallDir$ + '"'
endif
endif
Winbatch_install_nsis
Sub_check_exitcode
else
comment "driveletter <> nil or installonUSB true"
Files_copy-usb
endif
endif
; ----------------------------------------------------------------
; install sections
; ----------------------------------------------------------------
[Winbatch_install_nsis]
$NsisInstallBatch$
[sub_check_exitcode]
if FileExists("%ScriptDrive%\check_nsis-exitcode.ins")
Sub "%ScriptDrive%\check_nsis-exitcode.ins"
else
if FileExists("%ScriptPath%\check_nsis_exitcode.opsiscript")
Sub "%ScriptPath%\check_nsis_exitcode.opsiscript"
else
LogError "SUB check_nsis-exitcode not found!"
endif
endif
[Files_copy-usb]
copy -su "%ScriptPath%\files.usb\" "$InstallUSBdriveLetter$\$OpsiProductName$\"
[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
; ----------------------------------------------------------------
; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib gmbh
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/en/credits/
[Actions]
requiredWinstVersion >= "4.11.3.3"
DefVar $SetupType$
DefVar $MsiId$
DefVar $LogDir$
DefVar $ExitCode$
DefVar $ErrorMsg$
DefVar $ProductId$
DefVar $InstallDir$
DefVar $LicenseRequired$
DefVar $LicensePool$
Set $LogDir$ = "%SystemDrive%\tmp"
; ----------------------------------------------------------------; ----------------------------------------------------------------
Set $SetupType$ = "nsis"
; ----------------------------------------------------------------; ----------------------------------------------------------------
; ----------------------------------------------------------------; ----------------------------------------------------------------
; - Please check the following values -
; ----------------------------------------------------------------
Set $ProductId$ = "mremoteng"
Set $InstallDir$ = "C:\Program Files (x86)\mRemoteNG"
Set $LicenseRequired$ = "false"
Set $LicensePool$ = "p_" + $ProductId$
; ----------------------------------------------------------------
comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
Message "Uninstalling " + $ProductId$ + " ..."
if FileExists("%ScriptPath%\delsub.opsiscript")
comment "Start uninstall sub section"
Sub "%ScriptPath%\delsub.opsiscript"
endif
if $LicenseRequired$ = "true"
comment "Licensing required, free license used"
Sub_free_license
endif
[Sub_free_license]
comment "License management is enabled and will be used"
comment "Trying to free license used for the product"
DefVar $result$
Set $result$ = FreeLicense($LicensePool$)
; If there is an assignment of a license pool to the product, it is possible to use
; Set $result$ = FreeLicense("", $ProductId$)
;
; If there is an assignment of a license pool to a windows software id, it is possible to use
; DefVar $WindowsSoftwareId$
; $WindowsSoftwareId$ = "..."
; set $result$ = FreeLicense("", "", $WindowsSoftwareId$)
; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib gmbh
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/en/credits/
DefVar $found$
DefVar $UninstallProgram$
Set $found$ = "false"
Message "Uninstalling " + $ProductId$ + " ..."
if ($SetupType$ = "nsis")
Set $UninstallProgram$ = $InstallDir$ + "\uninstall.exe"
if (not($InstallDir$ = '')) and FileExists($UninstallProgram$)
comment "Uninstall program found, starting uninstall"
Winbatch_uninstall_nsis /WaitforProcessending "Au_.exe" /Timeoutseconds 10
sub_check_exitcode
endif
endif
if (not($InstallDir$ = '')) and (not($InstallDir$ = "not used"))
Files_uninstall
endif
;-----------------------------------------------------
[Winbatch_uninstall_nsis]
"$UninstallProgram$" /S
;-----------------------------------------------------
[sub_check_exitcode]
Sub "%ScriptDrive%\check_nsis-exitcode.ins"
[Files_uninstall]
del -sf "$InstallDir$\"
;-----------------------------------------------------
[Package] version: 4 depends: incremental: False [Product] type: localboot id: mremoteng name: mRemoteNG description: OpenSource-Sitzungsmanager fuer RDP-, SSH-, ICA-, VNC- und HTTP-Sessions (auch als portable usb verfügbar) advice: (Krummel: Paket aktuelisiert am 15.9.2014) version: 1.73 priority: 0 licenseRequired: False productClasses: setupScript: setup.opsiscript uninstallScript: uninstall.opsiscript updateScript: alwaysScript: onceScript: customScript: userLoginScript: [ProductDependency] action: setup requiredProduct: dotnet requiredStatus: installed requirementType: before [ProductProperty] type: bool name: usb description: USB Installation default: False [ProductProperty] type: unicode name: usbdriveletter multivalue: False editable: True description: Drive letter for usb installation values: ["F:"] default: ["F:"]