====== Tortoise-svn ======
2012-06-04\\
Script by uib GmbH \\
Comments and improvements welcome \\
id: tortoise-svn\\
name: TortoiseSVN\\
description: Windows Subversion Client 32/64 Bit\\
version: 1.7.9\\
Full package: http://download.uib.de/opsi4.0/products/contribute/full-package/
==== setup.ins ====
; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/credits/
[Actions]
requiredWinstVersion >= "4.11.3.3"
DefVar $LogDir$
DefVar $ProductId$
DefVar $MinimumSpace$
DefVar $InstallDir32$
DefVar $InstallDir64$
DefVar $ExitCode$
DefVar $LicenseRequired$
DefVar $LicenseKey$
DefVar $LicensePool$
DefVar $INST_SystemType$
DefVar $INST_architecture$
DefVar $installer32$
DefVar $installer64$
DefVar $MsiId$
DefStringlist $MsiIdList$
DefStringlist $MsiIdRegList$
Set $INST_SystemType$ = GetSystemType
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
Set $LogDir$ = "%SystemDrive%\tmp"
; ----------------------------------------------------------------
; - Please edit the following values -
; ----------------------------------------------------------------
Set $ProductId$ = "tortoise-svn"
Set $MinimumSpace$ = "50 MB"
; the path were we find the product after the installation
Set $InstallDir32$ = "%ProgramFiles32Dir%\tortoisesvn"
Set $InstallDir64$ = "%ProgramFiles64Dir%\tortoisesvn"
set $installer32$ = "TortoiseSVN-1.7.9.23248-win32-svn-1.7.6.msi"
set $installer64$ = "TortoiseSVN-1.7.9.23248-x64-svn-1.7.6.msi"
; ----------------------------------------------------------------
if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
isFatalError "no space"
; Stop process and set installation status to failed
else
comment "Show product picture"
ShowBitmap "%ScriptPath%\\" + $ProductId$ + ".png" $ProductId$
if FileExists("%ScriptPath%\delsub.ins")
comment "Start uninstall sub section"
Sub "%ScriptPath%\delsub.ins"
endif
comment "installing"
if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
Message "Installing " + $ProductId$ + " 32 Bit..."
comment "Start setup program"
Winbatch_install_32
Sub_check_exitcode
endif
if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
Message "Installing " + $ProductId$ + " 64 Bit..."
comment "Start setup program"
Winbatch_install_64
Sub_check_exitcode
endif
endif
[Winbatch_install_32]
; === MSI package =======================================================================================
msiexec /i "%ScriptPath%\$installer32$" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=1 REBOOT=ReallySuppress
[Winbatch_install_64]
; === MSI package =======================================================================================
msiexec /i "%ScriptPath%\$installer64$" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=1 REBOOT=ReallySuppress
[Winbatch_uninstall_msi]
msiexec /x $MsiId$ /qb! REBOOT=ReallySuppress
[ExecWith_autoit_close_window]
; exact title match
;Opt("WinTitleMatchMode", 3)
$mylog = FileOpen("$LogDir$\au3.log", 2)
FileWriteLine($mylog,"auto-it started - waiting for the window")
; do not use winwait(), it will fail on other desktops than current
$seconds = 0
$exists = 0
While ($seconds <= 300) and ($exists = 0)
$exists = WinExists("TortoiseSVN","The following applications")
FileWriteLine($mylog,"winexists result (1=exists): " & $exists )
$seconds = $seconds + 1
sleep(1000)
WEnd
FileWriteLine($mylog,"window detected - sending answer")
; next
$result = ControlClick("TortoiseSVN","The following applications", 3001)
FileWriteLine($mylog,"answer sended: result (1=success) : " & $result)
Blockinput(0)
FileClose($mylog)
;Sleep(500)
;and good bye
Exit @error
[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode
; informations to exit codes see
; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
; http://msdn.microsoft.com/en-us/library/aa368542.aspx
if ($ExitCode$ = "0")
comment "Looks good: setup program gives exitcode zero"
else
comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
if ($ExitCode$ = "1605")
comment "ERROR_UNKNOWN_PRODUCT 1605 This action is only valid for products that are currently installed."
comment "Uninstall of a not installed product failed - no problem"
else
if ($ExitCode$ = "1641")
comment "looks good: setup program gives exitcode 1641"
comment "ERROR_SUCCESS_REBOOT_INITIATED 1641 The installer has initiated a restart. This message is indicative of a success."
else
if ($ExitCode$ = "3010")
comment "looks good: setup program gives exitcode 3010"
comment "ERROR_SUCCESS_REBOOT_REQUIRED 3010 A restart is required to complete the install. This message is indicative of a success."
else
logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
isFatalError "Exit Code=" + $ExitCode$
endif
endif
endif
endif
==== delsub.ins ====
; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib gmbh
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/credits/
comment "collect known MSI IDs of the product"
set $MsiIdList$ = createStringList('{DE9CF741-20F7-488B-8B85-9D0F86FA51B4}')
set $MsiIdList$ = addtolist($MsiIdList$,'{6E8AA68E-AE56-48EE-ACE6-05647EA46F6A}')
set $MsiIdList$ = addtolist($MsiIdList$,'{4371D69B-FB6A-4A61-8477-C1B919FB2311}')
set $MsiIdList$ = addtolist($MsiIdList$,'{5D762D74-E92F-4E95-9255-D85312617E4D}')
comment "collect Installed MSI IDs"
set $MsiIdRegList$ = getRegistryKeyList32("HKLM\Software\Microsoft\Windows\Currentversion\uninstall")
set $MsiIdRegList$ = addListToList($MsiIdRegList$, getRegistryKeyList64("HKLM\Software\Microsoft\Windows\Currentversion\uninstall"))
comment "uninstall all we find..."
for %s% in $MsiIdList$ do sub_uninstall
[sub_uninstall]
if not ("" = takeFirstStringContaining($MsiIdRegList$,"%s%"))
comment "MSI id %s% found in registry, starting msiexec to uninstall"
if not ("" = takeFirstStringContaining(GetProcessList,"explorer.exe"))
comment "explorer will be killed - so we have to reboot"
Exitwindows /Reboot
endif
set $MsiId$ = "%s%"
ExecWith_autoit_close_window "%scriptpath%\autoit3.exe" winst /LetThemGo
Winbatch_uninstall_msi
killtask "autoit3.exe"
sub_check_exitcode
includelog $LogDir$+"\au3.log" "50"
endif
[Winbatch_uninstall_msi]
msiexec /x $MsiId$ /qb! REBOOT=ReallySuppress
[ExecWith_autoit_close_window]
; exact title match
;Opt("WinTitleMatchMode", 3)
$mylog = FileOpen("$LogDir$\au3.log", 2)
FileWriteLine($mylog,"auto-it started - waiting for the window")
; do not use winwait(), it will fail on other desktops than current
$seconds = 0
$exists = 0
While ($seconds <= 300) and ($exists = 0)
$exists = WinExists("TortoiseSVN","The following applications")
FileWriteLine($mylog,"winexists result (1=exists): " & $exists )
$seconds = $seconds + 1
sleep(1000)
WEnd
FileWriteLine($mylog,"window detected - sending answer")
; next
$result = ControlClick("TortoiseSVN","The following applications", 3001)
FileWriteLine($mylog,"answer sended: result (1=success) : " & $result)
Blockinput(0)
FileClose($mylog)
;Sleep(500)
;and good bye
Exit @error
[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode
; informations to exit codes see
; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
; http://msdn.microsoft.com/en-us/library/aa368542.aspx
if ($ExitCode$ = "0")
comment "Looks good: setup program gives exitcode zero"
else
comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
if ($ExitCode$ = "1605")
comment "ERROR_UNKNOWN_PRODUCT 1605 This action is only valid for products that are currently installed."
comment "Uninstall of a not installed product failed - no problem"
else
if ($ExitCode$ = "1641")
comment "looks good: setup program gives exitcode 1641"
comment "ERROR_SUCCESS_REBOOT_INITIATED 1641 The installer has initiated a restart. This message is indicative of a success."
else
if ($ExitCode$ = "3010")
comment "looks good: setup program gives exitcode 3010"
comment "ERROR_SUCCESS_REBOOT_REQUIRED 3010 A restart is required to complete the install. This message is indicative of a success."
else
logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
isFatalError "Exit Code=" + $ExitCode$
endif
endif
endif
endif
==== uninstall.ins ====
; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib gmbh
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/credits/
[Actions]
requiredWinstVersion >= "4.11.3.3"
DefVar $LogDir$
DefVar $ExitCode$
DefVar $ProductId$
DefVar $InstallDir32$
DefVar $InstallDir64$
DefVar $LicenseRequired$
DefVar $LicensePool$
DefVar $INST_SystemType$
DefVar $INST_architecture$
DefVar $MsiId$
DefStringlist $MsiIdList$
DefStringlist $MsiIdRegList$
Set $INST_SystemType$ = GetSystemType
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
Set $LogDir$ = "%SystemDrive%\tmp"
; ----------------------------------------------------------------
; - Please edit the following values -
; ----------------------------------------------------------------
Set $ProductId$ = "tortoise-svn"
Set $InstallDir32$ = "%ProgramFiles32Dir%\tortoisesvn"
Set $InstallDir64$ = "%ProgramFiles64Dir%\tortoisesvn"
; ----------------------------------------------------------------
comment "Show product picture"
ShowBitmap "%ScriptPath%\\" + $ProductId$ + ".png" $ProductId$
Message "Uninstalling " + $ProductId$ + " ..."
if FileExists("%ScriptPath%\delsub.ins")
comment "Start uninstall sub section"
Sub "%ScriptPath%\delsub.ins"
endif
[Winbatch_uninstall_msi]
msiexec /x $MsiId$ /qb! REBOOT=ReallySuppress