From 71c5b93a52cb57c60cad6feef2b78a77db61e434 Mon Sep 17 00:00:00 2001 From: Dominik Daehn Date: Tue, 11 Jun 2019 17:01:19 +0200 Subject: [PATCH] change $LogDir$ to "%opsiLogDir%" add Property custom-post-install, custom-post-uninstall, defaultassociations, desktoplink --- CLIENT_DATA/delsub3264.ins | 14 +++++ CLIENT_DATA/setup3264.ins | 102 ++++++++++++++++++++++------------ CLIENT_DATA/uninstall3264.ins | 2 +- 3 files changed, 83 insertions(+), 35 deletions(-) diff --git a/CLIENT_DATA/delsub3264.ins b/CLIENT_DATA/delsub3264.ins index 2c90baa..2eb66cd 100644 --- a/CLIENT_DATA/delsub3264.ins +++ b/CLIENT_DATA/delsub3264.ins @@ -71,6 +71,17 @@ endif comment "Delete program shortcuts" LinkFolder_uninstall +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_32] ; Choose one of the following examples as basis for program uninstall ; @@ -142,6 +153,9 @@ 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" set $ExitCode$ = getLastExitCode diff --git a/CLIENT_DATA/setup3264.ins b/CLIENT_DATA/setup3264.ins index 121b752..fb93805 100644 --- a/CLIENT_DATA/setup3264.ins +++ b/CLIENT_DATA/setup3264.ins @@ -25,13 +25,18 @@ DefVar $OLD_VERSION$ DefVar $OLD_CREATOR_TAG$ DefVar $OLD_RELEASE$ +;Property Variables +DefVar $Property_CustomPostInstall$ +DefVar $Property_DesktopLink$ +DefVar $Property_defaultassociations$ + DefVar $InstallDir$ DefVar $ProgExe$ Set $INST_SystemType$ = GetSystemType set $INST_architecture$ = GetProductProperty("install_architecture","system specific") -Set $LogDir$ = "%SystemDrive%\tmp" +Set $LogDir$ = "%opsiLogDir%" ; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh ; and adds the following variables: @@ -81,15 +86,23 @@ else ; Sub_check_exitcode comment "Copy files" Files_install_32 /32Bit - Files_install_config /AllNtUserProfiles - DosInAnIcon_set_config +; Files_install_config /AllNtUserProfiles +; DosInAnIcon_set_config Set $InstallDir$ = $InstallDir32$ Set $ProgExe$ = $Prog32$ - DosInAnIcon_install winst /32bit + Set $Property_defaultassociations$ = GetProductProperty("defaultassociations","true") + if ($Property_defaultassociations$ = "true") + DosInAnIcon_install winst /32bit + endif comment "Patch Registry" Registry_install /32Bit comment "Create shortcuts" LinkFolder_install_32 + Set $Property_DesktopLink$ = GetProductProperty("DesktopLink","false") + if ($Property_DesktopLink$ = "true") + comment "Install Desktop Link" + LinkFolder_install_DesktopLink_32 + endif endif if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only")) @@ -100,15 +113,33 @@ else ; Sub_check_exitcode comment "Copy files" Files_install_64 /64Bit - Files_install_config /AllNTUserProfiles - DosInAnIcon_set_config +; Files_install_config /AllNTUserProfiles +; DosInAnIcon_set_config Set $InstallDir$ = $InstallDir64$ Set $ProgExe$ = $Prog64$ - DosInAnIcon_install winst /64bit + Set $Property_defaultassociations$ = GetProductProperty("defaultassociations","true") + if ($Property_defaultassociations$ = "true") + DosInAnIcon_install winst /64bit + endif comment "Patch Registry" Registry_install /64Bit comment "Create shortcuts" LinkFolder_install_64 + Set $Property_DesktopLink$ = GetProductProperty("DesktopLink","false") + if ($Property_DesktopLink$ = "true") + comment "Install Desktop Link" + LinkFolder_install_DesktopLink_64 + endif + 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 @@ -142,11 +173,11 @@ rem Set Default Associations for Windows 8 move "$LogDir$\defaultassociations.xml" "%System%" REG ADD HKLM\Software\Policies\Microsoft\Windows\System /V DefaultAssociationsConfiguration /D "%System%\defaultassociations.xml" /F -[Files_install_config] -copy "%ScriptPath%\Imagine.ini" "%UserProfileDir%\Anwendungsdaten\Imagine" +;[Files_install_config] +;copy "%ScriptPath%\Imagine.ini" "%UserProfileDir%\Anwendungsdaten\Imagine" -[DosInAnIcon_set_config] -attrib +r "$InstallDir$\Imagine.ini" +;[DosInAnIcon_set_config] +;attrib +r "$InstallDir$\Imagine.ini" [Winbatch_install_32] "$Install32Exe$" /S /D="$InstallDir32$" @@ -199,21 +230,22 @@ set_link icon_file: icon_index: end_link + +[LinkFolder_install_DesktopLink_32] ; ; 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: $NAME$ -; target: "$InstallDir32$\Imagine.exe" -; parameters: -; working_dir: $InstallDir32$ -; icon_file: -; icon_index: -;end_link - +set_link + name: $NAME$ + target: "$InstallDir32$\Imagine.exe" + parameters: + working_dir: $InstallDir32$ + icon_file: + icon_index: +end_link [LinkFolder_install_64] ; Example of deleting a folder from AllUsers startmenu: @@ -234,23 +266,25 @@ set_link icon_file: icon_index: end_link + +[LinkFolder_install_DesktopLink_64] ; ; 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: $NAME$ -; target: "$InstallDir64$\Imagine64.exe" -; parameters: -; working_dir: $InstallDir64$ -; icon_file: -; icon_index: -;end_link - - +set_link + name: $NAME$ + target: "$InstallDir64$\Imagine64.exe" + parameters: + working_dir: $InstallDir64$ + 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/uninstall3264.ins b/CLIENT_DATA/uninstall3264.ins index 6046cfc..0b92a83 100644 --- a/CLIENT_DATA/uninstall3264.ins +++ b/CLIENT_DATA/uninstall3264.ins @@ -29,7 +29,7 @@ DefVar $OLD_RELEASE$ Set $INST_SystemType$ = GetSystemType set $INST_architecture$ = GetProductProperty("install_architecture","system specific") -Set $LogDir$ = "%SystemDrive%\tmp" +Set $LogDir$ = "%opsiLogDir%" ; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh ; and adds the following variables: