add ProductProperty DesktopLink, CustomPostInstall, CustomPostUninstall

This commit is contained in:
Dominik Daehn 2019-10-18 10:03:51 +02:00
parent 015472abcf
commit ab8035806c
8 changed files with 227 additions and 0 deletions

View File

@ -81,6 +81,17 @@ LinkFolder_uninstall
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_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
if $Reboot$="1"
ExitWindows /ImmediateReboot
endif
@ -124,6 +135,10 @@ msiexec /x $MsiId$ /qb-! REBOOT=ReallySuppress
; deletekey [HKEY_LOCAL_MACHINE\Software\$ProductId$]
[LinkFolder_uninstall]
set_basefolder common_desktopdirectory
set_subfolder ""
delete_element $NAME$
; Example of deleting a folder from AllUsers startmenu:
;
; set_basefolder common_programs
@ -146,6 +161,9 @@ msiexec /x $MsiId$ /qb-! REBOOT=ReallySuppress
;
; SFTA --unreg Applications\SumatraPDF.exe .pdf
[sub_CustomPostUninstall]
include_insert "%ScriptPath%\custom\" + $Property_CustomPostUninstall$
[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode

View File

@ -152,6 +152,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
if $Reboot$="1"
ExitWindows /ImmediateReboot
endif
@ -229,6 +240,10 @@ msiexec /x $MsiId64$ /qb-! REBOOT=ReallySuppress
; deletekey [HKEY_LOCAL_MACHINE\Software\$ProductId$]
[LinkFolder_uninstall]
set_basefolder common_desktopdirectory
set_subfolder ""
delete_element $NAME$
; Example of deleting a folder from AllUsers startmenu:
;
; set_basefolder common_programs
@ -251,6 +266,9 @@ msiexec /x $MsiId64$ /qb-! REBOOT=ReallySuppress
;
; SFTA --unreg Applications\SumatraPDF.exe .pdf
[sub_CustomPostUninstall]
include_insert "%ScriptPath%\custom\" + $Property_CustomPostUninstall$
[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode

View File

@ -81,6 +81,17 @@ LinkFolder_uninstall
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_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
if $Reboot$="1"
ExitWindows /ImmediateReboot
endif
@ -124,6 +135,10 @@ msiexec /x $MsiId$ /qb-! REBOOT=ReallySuppress
; deletekey [HKEY_LOCAL_MACHINE\Software\$ProductId$]
[LinkFolder_uninstall]
set_basefolder common_desktopdirectory
set_subfolder ""
delete_element $NAME$
; Example of deleting a folder from AllUsers startmenu:
;
; set_basefolder common_programs
@ -146,6 +161,9 @@ msiexec /x $MsiId$ /qb-! REBOOT=ReallySuppress
;
; SFTA --unreg Applications\SumatraPDF.exe .pdf
[sub_CustomPostUninstall]
include_insert "%ScriptPath%\custom\" + $Property_CustomPostUninstall$
[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode

View File

@ -34,6 +34,10 @@ set $languageInfo$ = getLocaleInfoMap
DefVar $LanguageId$
set $LanguageId$ = getValue("default_language_id_decimal", $languageInfo$)
;Property Variables
DefVar $Property_CustomPostInstall$
DefVar $Property_DesktopLink$
Set $LogDir$ = "%opsiLogDir%"
; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh
@ -120,9 +124,24 @@ else
comment "Create shortcuts"
LinkFolder_install
Set $Property_DesktopLink$ = GetProductProperty("DesktopLink","false")
if ($Property_DesktopLink$ = "true")
LinkFolder_install_DesktopLink
endif
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_install
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
[Winbatch_install]
@ -206,6 +225,22 @@ delete_element "$NAME$"
; icon_index: 2
; end_link
[LinkFolder_install_DesktopLink]
;
; Example of creating an shortcut to the installed exe on AllUsers desktop:
;
set_basefolder common_desktopdirectory
set_subfolder ""
;
set_link
name: $NAME$
target: "$InstallDir$\$ProgramExecutable$"
parameters:
working_dir: $InstallDir$
icon_file:
icon_index:
end_link
[DosInAnIcon_FileTypeAssoc_install]
; Requires danysys.sfta
; Sample Usage:
@ -229,6 +264,9 @@ delete_element "$NAME$"
; Update value of an element
; xml ed -u "/xml/table/rec[@id=1]/numField" -v 0 "$InstallDir$\config.xml"> "$InstallDir$\config.model.xml"
[sub_CustomPostInstall]
include_insert "%ScriptPath%\custom\" + $Property_CustomPostInstall$
[Sub_get_licensekey]
if opsiLicenseManagementEnabled
comment "License management is enabled and will be used"

View File

@ -44,6 +44,10 @@ set $languageInfo$ = getLocaleInfoMap
DefVar $LanguageId$
set $LanguageId$ = getValue("default_language_id_decimal", $languageInfo$)
;Property Variables
DefVar $Property_CustomPostInstall$
DefVar $Property_DesktopLink$
Set $LogDir$ = "%opsiLogDir%"
; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh
@ -127,6 +131,10 @@ else
Registry_install /32Bit
comment "Create shortcuts"
LinkFolder_install_32
Set $Property_DesktopLink$ = GetProductProperty("DesktopLink","false")
if ($Property_DesktopLink$ = "true")
LinkFolder_install_DesktopLink_32
endif
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_install
endif
@ -151,10 +159,24 @@ else
Registry_install /64Bit
comment "Create shortcuts"
LinkFolder_install_64
Set $Property_DesktopLink$ = GetProductProperty("DesktopLink","false")
if ($Property_DesktopLink$ = "true")
LinkFolder_install_DesktopLink_64
endif
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_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
[Winbatch_install_32]
@ -335,6 +357,38 @@ delete_element "$NAME$"
; icon_index: 2
; 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_link
name: $NAME$
target: "$InstallDir32$\$ProgramExecutable32$"
parameters:
working_dir: $InstallDir32$
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_link
name: $NAME$
target: "$InstallDir64$\$ProgramExecutable64$"
parameters:
working_dir: $InstallDir64$
icon_file:
icon_index:
end_link
[DosInAnIcon_FileTypeAssoc_install]
; Requires danysys.sfta
; Sample Usage:
@ -346,6 +400,9 @@ delete_element "$NAME$"
;
; SFTA Applications\SumatraPDF.exe .pdf
[sub_CustomPostInstall]
include_insert "%ScriptPath%\custom\" + $Property_CustomPostInstall$
[Sub_get_licensekey]
comment "License management is enabled and will be used"

View File

@ -34,6 +34,10 @@ set $languageInfo$ = getLocaleInfoMap
DefVar $LanguageId$
set $LanguageId$ = getValue("default_language_id_decimal", $languageInfo$)
;Property Variables
DefVar $Property_CustomPostInstall$
DefVar $Property_DesktopLink$
Set $LogDir$ = "%opsiLogDir%"
; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh
@ -120,9 +124,24 @@ else
comment "Create shortcuts"
LinkFolder_install
Set $Property_DesktopLink$ = GetProductProperty("DesktopLink","false")
if ($Property_DesktopLink$ = "true")
LinkFolder_install_DesktopLink
endif
comment "File Type Association"
DosInAnIcon_FileTypeAssoc_install
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
[Winbatch_install]
@ -206,6 +225,22 @@ delete_element "$NAME$"
; icon_index: 2
; end_link
[LinkFolder_install_DesktopLink]
;
; Example of creating an shortcut to the installed exe on AllUsers desktop:
;
set_basefolder common_desktopdirectory
set_subfolder ""
;
set_link
name: $NAME$
target: "$InstallDir$\$ProgramExecutable$"
parameters:
working_dir: $InstallDir$
icon_file:
icon_index:
end_link
[DosInAnIcon_FileTypeAssoc_install]
; Requires danysys.sfta
; Sample Usage:
@ -229,6 +264,9 @@ delete_element "$NAME$"
; Update value of an element
; xml ed -u "/xml/table/rec[@id=1]/numField" -v 0 "$InstallDir$\config.xml"> "$InstallDir$\config.model.xml"
[sub_CustomPostInstall]
include_insert "%ScriptPath%\custom\" + $Property_CustomPostInstall$
[Sub_get_licensekey]
if opsiLicenseManagementEnabled
comment "License management is enabled and will be used"

View File

@ -7,3 +7,19 @@
# PRODUCT_ID: id of the current product
# CLIENT_DATA_DIR: directory which contains the installed client data
#
TMP_DIR=${CLIENT_DATA_DIR}/../${PRODUCT_ID}.tmp
if [ -d $TMP_DIR ]; then
echo 'Restoring previous directories...'
echo 'Restoring previous custom dir...'
if [ -d $TMP_DIR/custom ]; then
test -e $CLIENT_DATA_DIR/custom && rm -rf $CLIENT_DATA_DIR/custom
echo " moving $TMP_DIR/custom to $CLIENT_DATA_DIR/"
mv $TMP_DIR/custom $CLIENT_DATA_DIR/ || exit 1
fi
fi
echo "Removing temporary files..."
rm -rf $TMP_DIR

View File

@ -7,3 +7,27 @@
# PRODUCT_ID: id of the current product
# CLIENT_DATA_DIR: directory where client data will be installed
#
TMP_DIR=${CLIENT_DATA_DIR}/../${PRODUCT_ID}.tmp
if [ -d $TMP_DIR ]; then
echo "Temporary directory $TMP_DIR already exist, aborting!" 1>&2
exit 1
fi
[ ! -d $CLIENT_DATA_DIR ] && mkdir $CLIENT_DATA_DIR
mkdir $TMP_DIR
if [ -d $CLIENT_DATA_DIR ]; then
echo "Saving previous directories..."
for dirname in custom ; do
for path in $CLIENT_DATA_DIR/$dirname; do
if [ -e $path ]; then
echo " moving $path to $TMP_DIR"
mv $path $TMP_DIR/ || exit 1
fi
done
done
fi
exit 0