From dcbeadc41eec6e3235f350de5ca0ca05d82baed4 Mon Sep 17 00:00:00 2001 From: Dominik Daehn Date: Wed, 19 Jun 2019 07:06:00 +0200 Subject: [PATCH] change LogDir; add ProductProperty desktoplink, custom-post-install, custom-post-uninstall fix uninstall - uncomment Winbatch_uninstall_old --- CLIENT_DATA/delsub32.ins | 54 +++++++++++++++++++++++-------------- CLIENT_DATA/setup32.ins | 46 ++++++++++++++++++++++--------- CLIENT_DATA/uninstall32.ins | 2 +- OPSI/control | 24 +++++++++++++++++ 4 files changed, 92 insertions(+), 34 deletions(-) diff --git a/CLIENT_DATA/delsub32.ins b/CLIENT_DATA/delsub32.ins index 4a4baca..2ea39eb 100644 --- a/CLIENT_DATA/delsub32.ins +++ b/CLIENT_DATA/delsub32.ins @@ -7,22 +7,22 @@ Set $UninstallProgram$ = $InstallDir$ + "\" + $UninstallProg$ Set $IniFile$ = $InstallDir$ + "\opsi-" + $ProductId$ + ".ini" -if FileExists($IniFile$) - Set $OLD_VERSION$ = GetValueFromInifile($IniFile$,"COMMON","VERSION","") - Set $OLD_CREATOR_TAG$ = GetValueFromInifile($IniFile$,"COMMON","CREATOR_TAG","") - Set $OLD_RELEASE$ = GetValueFromInifile($IniFile$,"COMMON","RELEASE","") -endif -Message "Uninstalling " + $ProductId$ + " " + $OLD_VERSION$ + "-" + $OLD_CREATOR_TAG$ + $OLD_RELEASE$ + " ..." +;if FileExists($IniFile$) +; Set $OLD_VERSION$ = GetValueFromInifile($IniFile$,"COMMON","VERSION","") +; Set $OLD_CREATOR_TAG$ = GetValueFromInifile($IniFile$,"COMMON","CREATOR_TAG","") +; Set $OLD_RELEASE$ = GetValueFromInifile($IniFile$,"COMMON","RELEASE","") +;endif +;Message "Uninstalling " + $ProductId$ + " " + $OLD_VERSION$ + "-" + $OLD_CREATOR_TAG$ + $OLD_RELEASE$ + " ..." -if FileExists($IniFile$) - Set $UninstallProg$ = GetValueFromInifile($IniFile$,"X86","UninstallProg","XXXXXXXX.exe") - Set $UninstallProgramOld$ = $InstallDir$ + "\" + $UninstallProg$ - if FileExists($UninstallProgramOld$) - comment "Uninstall program found, starting uninstall" - Winbatch_uninstall_old - sub_check_exitcode - endif -endif +;if FileExists($IniFile$) +; Set $UninstallProg$ = GetValueFromInifile($IniFile$,"X86","UninstallProg","XXXXXXXX.exe") +; Set $UninstallProgramOld$ = $InstallDir$ + "\" + $UninstallProg$ +; if FileExists($UninstallProgramOld$) +; comment "Uninstall program found, starting uninstall" +; Winbatch_uninstall_old +; sub_check_exitcode +; endif +;endif if FileExists($UninstallProgram$) comment "Uninstall program found, starting uninstall" Winbatch_uninstall @@ -38,8 +38,19 @@ Registry_uninstall /32Bit comment "Delete program shortcuts" LinkFolder_uninstall -[Winbatch_uninstall_old] -"$UninstallProgramOld$" /silent /norestart /SUPPRESSMSGBOXES /nocancel +DefVar $Property_CustomPostUninstall$ +Set $Property_CustomPostUninstall$ = getProductProperty("custom-post-uninstall","none") +if not ($Property_CustomPostUninstall$ = "none") + comment "Include custom post uninstall file" + if FileExists("%ScriptPath%\custom\" + $Property_CustomPostUninstall$) + sub_CustomPostUninstall + else + LogError "Include script NOT exists (" + $Property_CustomPostUninstall$ +")" + endif +endif + +;[Winbatch_uninstall_old] +;"$UninstallProgramOld$" /silent /norestart /SUPPRESSMSGBOXES /nocancel [Winbatch_uninstall] @@ -64,9 +75,12 @@ del -sf "$InstallDir$\" ; ; Example of deleting a shortcut from AllUsers desktop: ; -; set_basefolder common_desktopdirectory -; set_subfolder "" -; delete_element $ProductId$ +set_basefolder common_desktopdirectory +set_subfolder "" +delete_element $NAME$ + +[sub_CustomPostUninstall] +include_insert "%ScriptPath%\custom\" + $Property_CustomPostUninstall$ [Sub_check_exitcode] comment "Test for installation success via exit code" diff --git a/CLIENT_DATA/setup32.ins b/CLIENT_DATA/setup32.ins index 3c5f10b..5281cfa 100644 --- a/CLIENT_DATA/setup32.ins +++ b/CLIENT_DATA/setup32.ins @@ -19,7 +19,11 @@ DefVar $OLD_VERSION$ DefVar $OLD_CREATOR_TAG$ DefVar $OLD_RELEASE$ -Set $LogDir$ = "%SystemDrive%\tmp" +;Property Variables +DefVar $Property_CustomPostInstall$ +DefVar $Property_DesktopLink$ + +Set $LogDir$ = "%opsiLogDir%" ; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh ; and adds the following variables: @@ -70,8 +74,21 @@ else comment "Patch Registry" Registry_install /32Bit - comment "Create shortcuts" - LinkFolder_install + Set $Property_DesktopLink$ = GetProductProperty("DesktopLink","false") + if ($Property_DesktopLink$ = "true") + comment "Create shortcuts" + LinkFolder_install + endif + + Set $Property_CustomPostInstall$ = getProductProperty("custom-post-install","none") + if not ($Property_CustomPostInstall$ = "none") + comment "Include custom post install file" + if FileExists("%ScriptPath%\custom\" + $Property_CustomPostInstall$) + sub_CustomPostInstall + else + LogError "Include script NOT exists (" + $Property_CustomPostInstall$ +")" + endif + endif endif @@ -116,17 +133,20 @@ copy "%ScriptPath%\fdm_uninstall.exe" "$InstallDir$" ; ; Example of creating an shortcut to the installed exe on AllUsers desktop: ; -; set_basefolder common_desktopdirectory -; set_subfolder "" +set_basefolder common_desktopdirectory +set_subfolder "" ; -; set_link -; name: $ProductId$ -; target: -; parameters: -; working_dir: $InstallDir$ -; icon_file: -; icon_index: 2 -; end_link +set_link + name: $NAME$ + target: "$InstallDir$\fdm.exe" + parameters: + working_dir: $InstallDir$ + icon_file: + icon_index: +end_link + +[sub_CustomPostInstall] +include_insert "%ScriptPath%\custom\" + $Property_CustomPostInstall$ [Sub_check_exitcode] comment "Test for installation success via exit code" diff --git a/CLIENT_DATA/uninstall32.ins b/CLIENT_DATA/uninstall32.ins index 9b7bc26..02ae999 100644 --- a/CLIENT_DATA/uninstall32.ins +++ b/CLIENT_DATA/uninstall32.ins @@ -18,7 +18,7 @@ DefVar $OLD_VERSION$ DefVar $OLD_CREATOR_TAG$ DefVar $OLD_RELEASE$ -Set $LogDir$ = "%SystemDrive%\tmp" +Set $LogDir$ = "%opsiLogDir%" ; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh ; and adds the following variables: diff --git a/OPSI/control b/OPSI/control index 48b5f43..3791a14 100644 --- a/OPSI/control +++ b/OPSI/control @@ -21,6 +21,30 @@ onceScript: customScript: userLoginScript: +[ProductProperty] +type: bool +name: desktoplink +description: Show Desktop Link on/off +default: False + +[ProductProperty] +type: unicode +name: custom-post-install +multivalue: False +editable: True +description: Define filename for include script in custom directory after installation +values: ["none"] +default: ["none"] + +[ProductProperty] +type: unicode +name: custom-post-uninstall +multivalue: False +editable: True +description: Define filename for include script in custom directory after uninstallation +values: ["none"] +default: ["none"] + [ProductDependency] action: setup requiredProduct: sereby.aio