add new uninstall system

This commit is contained in:
Mario Fetka 2012-05-13 15:28:24 +02:00
parent 047caebf2f
commit 4c9333e5aa
5 changed files with 51 additions and 9 deletions

View File

@ -4,10 +4,18 @@
; credits: http://www.opsi.org/credits/ ; credits: http://www.opsi.org/credits/
Set $MsiId$ = '{AC76BA86-7AD7-1031-7B44-AA1000000001}' Set $IniFile$ = $InstallDir$ + "\opsi-" + $ProductId$ + ".ini"
Message "Uninstalling " + $ProductId$ + " ..." Message "Uninstalling " + $ProductId$ + " ..."
if FileExists($IniFile$)
Set $MsiIdOld$ = GetValueFromInifile($IniFile$,"X86","MsiId","{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}")
if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiIdOld$ + "] DisplayName") = "")
comment "Old MSI id " + $MsiIdOld$ + " found in registry, starting msiexec to uninstall old version"
Winbatch_uninstall_msi_old
sub_check_exitcode
endif
endif
if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId$ + "] DisplayName") = "") if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId$ + "] DisplayName") = "")
comment "MSI id " + $MsiId$ + " found in registry, starting msiexec to uninstall" comment "MSI id " + $MsiId$ + " found in registry, starting msiexec to uninstall"
Winbatch_uninstall_msi Winbatch_uninstall_msi
@ -23,6 +31,9 @@ Registry_uninstall /32Bit
comment "Delete program shortcuts" comment "Delete program shortcuts"
LinkFolder_uninstall LinkFolder_uninstall
[Winbatch_uninstall_msi_old]
msiexec /x $MsiIdOld$ /qb! REBOOT=ReallySuppress
[Winbatch_uninstall_msi] [Winbatch_uninstall_msi]
msiexec /x $MsiId$ /qb! REBOOT=ReallySuppress msiexec /x $MsiId$ /qb! REBOOT=ReallySuppress

View File

@ -0,0 +1,6 @@
[X86]
MsiId={AC76BA86-7AD7-1031-7B44-AA1000000001}
[COMMON]
PN=adobe.acrobatreader
VERSION=10.1.2.0

View File

@ -6,7 +6,11 @@
[Actions] [Actions]
requiredWinstVersion >= "4.10.8.6" requiredWinstVersion >= "4.10.8.6"
DefVar $MsiId$ ; DefVar $MsiId$
DefVar $MsiIdOld$
DefVar $UninstallProgram$
DefVar $IniFile$
DefVar $IniCfgFile$
DefVar $LogDir$ DefVar $LogDir$
DefVar $ProductId$ DefVar $ProductId$
DefVar $MinimumSpace$ DefVar $MinimumSpace$
@ -35,6 +39,7 @@ Set $ProductId$ = "adobe.acrobatreader"
Set $MinimumSpace$ = "150 MB" Set $MinimumSpace$ = "150 MB"
; the path were we find the product after the installation ; the path were we find the product after the installation
Set $InstallDir$ = "%ProgramFiles32Dir%\Adobe\Reader 10.0\Reader\" Set $InstallDir$ = "%ProgramFiles32Dir%\Adobe\Reader 10.0\Reader\"
Set $IniCfgFile$ = "%ScriptPath%\opsi-" + $ProductId$ + ".ini"
; ---------------------------------------------------------------- ; ----------------------------------------------------------------
if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$)) if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
@ -77,9 +82,12 @@ else
endif endif
[Winbatch_install] [Winbatch_install]
msiexec /i "$InstallMsi$" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=2 REBOOT=ReallySuppress EULA_ACCEPT=YES msiexec /i "$InstallMsi$" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=2 REBOOT=ReallySuppress
[Files_install] [Files_install]
; copy the ini file to the InstallDir
copy "$IniCfgFile$" "$InstallDir$"
; Example of recursively copying some files into the installation directory: ; Example of recursively copying some files into the installation directory:
; ;
; copy -s "%ScriptPath%\files\*.*" "$InstallDir$" ; copy -s "%ScriptPath%\files\*.*" "$InstallDir$"
@ -87,10 +95,10 @@ msiexec /i "$InstallMsi$" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSE
[Registry_install] [Registry_install]
; Example of setting some values of an registry key: ; Example of setting some values of an registry key:
; ;
openkey [HKEY_LOCAL_MACHINE\Policies\Adobe\Acrobat Reader\10.0\FeatureLockDown] ; openkey [HKEY_LOCAL_MACHINE\Software\$ProductId$]
set "bUpdater" = REG_DWORD:0000 ; set "name1" = "some string value"
set "bProtectedMode" = REG_DWORD:0000 ; set "name2" = REG_DWORD:0001
; set "name3" = REG_BINARY:00 af 99 cd
[LinkFolder_install] [LinkFolder_install]
; Example of deleting a folder from AllUsers startmenu: ; Example of deleting a folder from AllUsers startmenu:

View File

@ -6,14 +6,28 @@
[Actions] [Actions]
requiredWinstVersion >= "4.10.8.6" requiredWinstVersion >= "4.10.8.6"
DefVar $MsiId$ ; DefVar $MsiId$
DefVar $MsiIdOld$
DefVar $UninstallProgram$
DefVar $LogDir$ DefVar $LogDir$
DefVar $IniFile$
DefVar $IniCfgFile$
DefVar $ExitCode$ DefVar $ExitCode$
DefVar $ProductId$ DefVar $ProductId$
DefVar $InstallDir$ DefVar $InstallDir$
Set $LogDir$ = "%SystemDrive%\tmp" Set $LogDir$ = "%SystemDrive%\tmp"
; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh
; and adds the following variables:
; from builder-product.cfg : all variables definded by attribute WINST[index]
; from builder-product.cfg : VENDOR PN VERSION RELEASE PRIORITY ADVICE TYPE
; from opsi-builder.cfg : CREATOR_TAG CREATOR_NAME CREATOR_EMAIL
; auto generated winst-variables
; $IconFile$: path to product picture
;
@@BUILDER_VARIABLES@@
; ---------------------------------------------------------------- ; ----------------------------------------------------------------
; - Please edit the following values - ; - Please edit the following values -
; ---------------------------------------------------------------- ; ----------------------------------------------------------------
@ -31,4 +45,3 @@ if FileExists("%ScriptPath%\delsub32.ins")
comment "Start uninstall sub section" comment "Start uninstall sub section"
Sub "%ScriptPath%\delsub32.ins" Sub "%ScriptPath%\delsub32.ins"
endif endif

View File

@ -26,3 +26,7 @@ ICON_DL_INDEX=0
WINST_NAME[0]="InstallMsi" WINST_NAME[0]="InstallMsi"
WINST_VALUE[0]="@DL_EXTRACT_WINST_PATH[1]@\\AcroRead.msi" WINST_VALUE[0]="@DL_EXTRACT_WINST_PATH[1]@\\AcroRead.msi"
WINST_NAME[1]="MsiId"
WINST_VALUE[1]="{AC76BA86-7AD7-1031-7B44-AA1000000001}"