From 3453e5a921b6407ff60698c1dd8f161e3fb5fc5f Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Wed, 13 Mar 2013 15:07:07 +0100 Subject: [PATCH] update to new opsi builder template --- CLIENT_DATA/delsub32.ins | 2 +- CLIENT_DATA/setup32.ins | 55 +++++++++++++++++++++++++++++++++---- CLIENT_DATA/uninstall32.ins | 23 ++++++++++++++++ OPSI/control | 11 +------- 4 files changed, 74 insertions(+), 17 deletions(-) diff --git a/CLIENT_DATA/delsub32.ins b/CLIENT_DATA/delsub32.ins index 5e9e5e7..1d3f9e2 100644 --- a/CLIENT_DATA/delsub32.ins +++ b/CLIENT_DATA/delsub32.ins @@ -32,4 +32,4 @@ deletekey [HKEY_LOCAL_MACHINE\Software\HighCriteria\DictationBuddy] [LinkFolder_uninstall] set_basefolder common_programs -delete_subfolder Dictation Buddy +delete_subfolder Dictation Buddy \ No newline at end of file diff --git a/CLIENT_DATA/setup32.ins b/CLIENT_DATA/setup32.ins index 247995f..ed9e717 100644 --- a/CLIENT_DATA/setup32.ins +++ b/CLIENT_DATA/setup32.ins @@ -13,11 +13,15 @@ DefVar $ProductId$ DefVar $MinimumSpace$ DefVar $InstallDir$ DefVar $ExitCode$ +DefVar $LicenseRequired$ +DefVar $LicenseKey$ +DefVar $LicensePool$ DefVar $OLD_VERSION$ DefVar $OLD_CREATOR_TAG$ DefVar $OLD_RELEASE$ Set $LogDir$ = "%SystemDrive%\tmp" +Set $OrgName$ = GetProductProperty ("orgname","OrgName") ; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh ; and adds the following variables: @@ -38,6 +42,8 @@ Set $LogDir$ = "%SystemDrive%\tmp" Set $MinimumSpace$ = "5 MB" ; the path were we find the product after the installation Set $InstallDir$ = "%ProgramFiles32Dir%\HighCriteria\DictationBuddy" +Set $LicenseRequired$ = "true" +Set $LicensePool$ = "p_" + $ProductId$ ; ---------------------------------------------------------------- Set $IniCfgFile$ = "%ScriptPath%\opsi-" + $ProductId$ + ".ini" @@ -57,9 +63,13 @@ else Message "Installing " + $ProductId$ + " "+ $VERSION$ + "-" + $CREATOR_TAG$ + $RELEASE$ + " ..." + if $LicenseRequired$ = "true" + comment "Licensing required, reserve license and get license key" + Sub_get_licensekey + endif + comment "Start setup program" ChangeDirectory "%SCRIPTPATH%" - comment "Copy files" Files_install /32Bit @@ -71,11 +81,8 @@ else endif - [Files_install] -copy "$IniCfgFile$" "$InstallDir$" -copy -s "%ScriptPath%\X86\*.*" "$InstallDir$" - +copy -s "%ScriptPath%\files\*.*" "$InstallDir$" [Registry_install] openkey [HKEY_LOCAL_MACHINE\Software\HighCriteria\DictationBuddy\WinReg] @@ -102,7 +109,7 @@ set_basefolder common_programs set_subfolder Dictation Buddy set_link - name: Dictation Buddy +name: Dictation Buddy target: $InstallDir$\dicbuddy.exe parameters: working_dir: $InstallDir$ @@ -110,3 +117,39 @@ set_link icon_index: end_link +[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 diff --git a/CLIENT_DATA/uninstall32.ins b/CLIENT_DATA/uninstall32.ins index 6a8db48..ac9582f 100644 --- a/CLIENT_DATA/uninstall32.ins +++ b/CLIENT_DATA/uninstall32.ins @@ -12,6 +12,8 @@ DefVar $LogDir$ DefVar $ExitCode$ DefVar $ProductId$ DefVar $InstallDir$ +DefVar $LicenseRequired$ +DefVar $LicensePool$ DefVar $OLD_VERSION$ DefVar $OLD_CREATOR_TAG$ DefVar $OLD_RELEASE$ @@ -32,6 +34,8 @@ Set $LogDir$ = "%SystemDrive%\tmp" ; - Please edit the following values - ; ---------------------------------------------------------------- Set $InstallDir$ = "%ProgramFiles32Dir%\HighCriteria\DictationBuddy" +Set $LicenseRequired$ = "true" +Set $LicensePool$ = "p_" + $ProductId$ ; ---------------------------------------------------------------- Set $IniCfgFile$ = "%ScriptPath%\opsi-" + $ProductId$ + ".ini" @@ -46,3 +50,22 @@ if FileExists("%ScriptPath%\delsub32.ins") Sub "%ScriptPath%\delsub32.ins" 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$) + diff --git a/OPSI/control b/OPSI/control index 96b565f..e1d4b75 100644 --- a/OPSI/control +++ b/OPSI/control @@ -21,18 +21,9 @@ onceScript: customScript: userLoginScript: -[ProductProperty] -type: unicode -name: install_architecture -multivalue: False -editable: False -description: which architecture (32/64 bit) has to be installed -values: ["32 only", "64 only", "both", "system specific"] -default: ["system specific"] - [ProductDependency] action: setup -requiredProduct: aio +requiredProduct: sereby.aio requiredStatus: installed requirementType: before