change $LogDir$ to "%opsiLogDir%"

add Property custom-post-install, custom-post-uninstall,  defaultassociations, desktoplink
This commit is contained in:
Dominik Daehn 2019-06-11 17:01:19 +02:00
parent 86e5a5aa8a
commit 71c5b93a52
3 changed files with 83 additions and 35 deletions

View File

@ -71,6 +71,17 @@ endif
comment "Delete program shortcuts" comment "Delete program shortcuts"
LinkFolder_uninstall 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] [Winbatch_uninstall_old_32]
; Choose one of the following examples as basis for program uninstall ; Choose one of the following examples as basis for program uninstall
; ;
@ -142,6 +153,9 @@ set_basefolder common_desktopdirectory
set_subfolder "" set_subfolder ""
delete_element $NAME$ delete_element $NAME$
[sub_CustomPostUninstall]
include_insert "%ScriptPath%\custom\" + $Property_CustomPostUninstall$
[Sub_check_exitcode] [Sub_check_exitcode]
comment "Test for installation success via exit code" comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode set $ExitCode$ = getLastExitCode

View File

@ -25,13 +25,18 @@ DefVar $OLD_VERSION$
DefVar $OLD_CREATOR_TAG$ DefVar $OLD_CREATOR_TAG$
DefVar $OLD_RELEASE$ DefVar $OLD_RELEASE$
;Property Variables
DefVar $Property_CustomPostInstall$
DefVar $Property_DesktopLink$
DefVar $Property_defaultassociations$
DefVar $InstallDir$ DefVar $InstallDir$
DefVar $ProgExe$ DefVar $ProgExe$
Set $INST_SystemType$ = GetSystemType Set $INST_SystemType$ = GetSystemType
set $INST_architecture$ = GetProductProperty("install_architecture","system specific") 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 ; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh
; and adds the following variables: ; and adds the following variables:
@ -81,15 +86,23 @@ else
; Sub_check_exitcode ; Sub_check_exitcode
comment "Copy files" comment "Copy files"
Files_install_32 /32Bit Files_install_32 /32Bit
Files_install_config /AllNtUserProfiles ; Files_install_config /AllNtUserProfiles
DosInAnIcon_set_config ; DosInAnIcon_set_config
Set $InstallDir$ = $InstallDir32$ Set $InstallDir$ = $InstallDir32$
Set $ProgExe$ = $Prog32$ 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" comment "Patch Registry"
Registry_install /32Bit Registry_install /32Bit
comment "Create shortcuts" comment "Create shortcuts"
LinkFolder_install_32 LinkFolder_install_32
Set $Property_DesktopLink$ = GetProductProperty("DesktopLink","false")
if ($Property_DesktopLink$ = "true")
comment "Install Desktop Link"
LinkFolder_install_DesktopLink_32
endif
endif endif
if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only")) 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 ; Sub_check_exitcode
comment "Copy files" comment "Copy files"
Files_install_64 /64Bit Files_install_64 /64Bit
Files_install_config /AllNTUserProfiles ; Files_install_config /AllNTUserProfiles
DosInAnIcon_set_config ; DosInAnIcon_set_config
Set $InstallDir$ = $InstallDir64$ Set $InstallDir$ = $InstallDir64$
Set $ProgExe$ = $Prog64$ 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" comment "Patch Registry"
Registry_install /64Bit Registry_install /64Bit
comment "Create shortcuts" comment "Create shortcuts"
LinkFolder_install_64 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
endif endif
@ -142,11 +173,11 @@ rem Set Default Associations for Windows 8
move "$LogDir$\defaultassociations.xml" "%System%" move "$LogDir$\defaultassociations.xml" "%System%"
REG ADD HKLM\Software\Policies\Microsoft\Windows\System /V DefaultAssociationsConfiguration /D "%System%\defaultassociations.xml" /F REG ADD HKLM\Software\Policies\Microsoft\Windows\System /V DefaultAssociationsConfiguration /D "%System%\defaultassociations.xml" /F
[Files_install_config] ;[Files_install_config]
copy "%ScriptPath%\Imagine.ini" "%UserProfileDir%\Anwendungsdaten\Imagine" ;copy "%ScriptPath%\Imagine.ini" "%UserProfileDir%\Anwendungsdaten\Imagine"
[DosInAnIcon_set_config] ;[DosInAnIcon_set_config]
attrib +r "$InstallDir$\Imagine.ini" ;attrib +r "$InstallDir$\Imagine.ini"
[Winbatch_install_32] [Winbatch_install_32]
"$Install32Exe$" /S /D="$InstallDir32$" "$Install32Exe$" /S /D="$InstallDir32$"
@ -199,21 +230,22 @@ set_link
icon_file: icon_file:
icon_index: icon_index:
end_link end_link
[LinkFolder_install_DesktopLink_32]
; ;
; Example of creating an shortcut to the installed exe on AllUsers desktop: ; Example of creating an shortcut to the installed exe on AllUsers desktop:
; ;
;set_basefolder common_desktopdirectory set_basefolder common_desktopdirectory
;set_subfolder "" set_subfolder ""
; ;
;set_link set_link
; name: $NAME$ name: $NAME$
; target: "$InstallDir32$\Imagine.exe" target: "$InstallDir32$\Imagine.exe"
; parameters: parameters:
; working_dir: $InstallDir32$ working_dir: $InstallDir32$
; icon_file: icon_file:
; icon_index: icon_index:
;end_link end_link
[LinkFolder_install_64] [LinkFolder_install_64]
; Example of deleting a folder from AllUsers startmenu: ; Example of deleting a folder from AllUsers startmenu:
@ -234,23 +266,25 @@ set_link
icon_file: icon_file:
icon_index: icon_index:
end_link end_link
[LinkFolder_install_DesktopLink_64]
; ;
; Example of creating an shortcut to the installed exe on AllUsers desktop: ; Example of creating an shortcut to the installed exe on AllUsers desktop:
; ;
;set_basefolder common_desktopdirectory set_basefolder common_desktopdirectory
;set_subfolder "" set_subfolder ""
; ;
;set_link set_link
; name: $NAME$ name: $NAME$
; target: "$InstallDir64$\Imagine64.exe" target: "$InstallDir64$\Imagine64.exe"
; parameters: parameters:
; working_dir: $InstallDir64$ working_dir: $InstallDir64$
; icon_file: icon_file:
; icon_index: icon_index:
;end_link end_link
[sub_CustomPostInstall]
include_insert "%ScriptPath%\custom\" + $Property_CustomPostInstall$
[Sub_check_exitcode] [Sub_check_exitcode]
comment "Test for installation success via exit code" comment "Test for installation success via exit code"

View File

@ -29,7 +29,7 @@ DefVar $OLD_RELEASE$
Set $INST_SystemType$ = GetSystemType Set $INST_SystemType$ = GetSystemType
set $INST_architecture$ = GetProductProperty("install_architecture","system specific") 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 ; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh
; and adds the following variables: ; and adds the following variables: