Views
WinstScripts
>>
thunderbird
last edited 3 months ago by sehlers
Three scripts (qualified for opsi 3.4) install (thunderbird.ins) and unistall (delsub.ins, delthunderbird.ins)
--------------------------------------------------------------------
thunderbird.ins
****************************************************************
; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib
; and published under the Terms of the General Public License.
[Initial]
; Message at install time:
Message=Installiere Thunderbird...
LogLevel=2
; Log Errors in Logfile but don't abort:
ExitOnError=false
; Show syntax errors in the script:
ScriptErrorMessages=on
; Dont trace step by step through the script:
TraceMode=off
; let started programs run in front of the winst window
StayOnTop=false
[Aktionen]
DefStringList $TimeOutList$
DefStringList $ProcessList$
DefVar $ProcFound$
DefVar $TimeOut$
DefVar $SearchProc$
DefVar $UninstallCommand$
DefVar $PRODUCTPATH$
DefStringList $profiles$
DefVar $akt_profile_ini$
DefVar $rel_prefs_path$
DefVar $akt_prefs_path$
DefVar $OS$
DefVar $TEMP$
DefVar $NewExe$
DefVar $ExitCode$
Set $TEMP$ = EnvVar("TEMP")
Set $PRODUCTPATH$="%ProgramFilesDir%\Mozilla Thunderbird"
set $NewExe$= $PRODUCTPATH$+"\thunderbird.exe"
set $OS$ = GetOS
; is this a win32 system ?
if ( $OS$ = "Windows_NT" OR $OS$ = "Windows_95" )
if not(HasMinimumSpace ("%SYSTEMDRIVE%", "100 MB"))
LogError "Nicht genuegend Platz auf C: . 100 MB auf C: fuer Thunderbird erforderlich."
isFatalError
; Bearbeitung beenden und Produktschalter auf failed setzen
else
; show product picture
ShowBitmap /3 "%scriptpath%\thunderbird.png" "Thunderbird"
DefVar $MozInstallDir$
DefVar $MozVersion$
DefVar $MozInstallPathRegKey$
set $MozVersion$ = GetRegistryStringValue ("[HKEY_LOCAL_MACHINE\Software\Mozilla\Mozilla Thunderbird] CurrentVersion")
set $MozInstallPathRegKey$ = "[HKEY_LOCAL_MACHINE\Software\Mozilla\Mozilla Thunderbird\"+$MozVersion$+"\Main]"
set $MozInstallDir$ = GetRegistryStringValue ($MozInstallPathRegKey$+" Install Directory")
if FileExists("%ScriptPath%\delsub.ins")
; start uninstall
sub "%ScriptPath%\delsub.ins"
endif
; Message at install time:
Message=Installiere Thunderbird...
; kill a running thunderbird
killtask "thunderbird.exe"
;Winbatch_start_taskmgr_for_debug /LetThemGo
; check for depotshare
if not (FileExists("%SCRIPTPATH%"))
DosInAnIcon_TryToReconnect
endif
; start setup program
if (IniVar ("thunderbird3.0") = "off")
Winbatch_thunderbird_silent_install_2
else
Winbatch_thunderbird_silent_install_3
endif
sub_check_exitcode
killtask "thunderbird.exe"
if not (FileExists ($NewExe$))
logError="Fatal: After Installation "+$NewExe$+" not found"
isFatalError
endif
; check for depotshare
if not (FileExists("%SCRIPTPATH%"))
DosInAnIcon_TryToReconnect
endif
Files_copy_profile_temp
if IniVar("enigmail") = "on"
; check for depotshare
if not (FileExists("%SCRIPTPATH%"))
DosInAnIcon_TryToReconnect
endif
if (IniVar ("thunderbird3.0") = "off")
WinBatch_install_enigmail_de2
else
WinBatch_install_enigmail_de3
endif
killtask "thunderbird.exe"
endif
if IniVar("lightning") = "on"
; check for depotshare
if not (FileExists("%SCRIPTPATH%"))
DosInAnIcon_TryToReconnect
endif
if (IniVar ("thunderbird3.0") = "off")
WinBatch_install_lightning2
else
WinBatch_install_lightning3
endif
killtask "thunderbird.exe"
endif
; check for depotshare
if not (FileExists("%SCRIPTPATH%"))
DosInAnIcon_TryToReconnect
endif
if (IniVar ("thunderbird3.0") = "off")
WinBatch_install_dictionary_de2
else
WinBatch_install_dictionary_de3
endif
killtask "thunderbird.exe"
if (IniVar("NoAutoUpdate") = "on")
; Einfangen der vom Dos-dir-Befehl produzierten Zeilen
Set $profiles$ = getOutStreamFromSection ('dosbatch_profiledir')
for $x$ in $profiles$ do sub_patch_prefs_file
PatchTextFile_profile_noautoupdate $PRODUCTPATH$+"\defaults\profile\prefs.js"
endif
;custom specific stuff
if FileExists("%ScriptPath%\custom_ins_dir\custom.ins")
sub "%ScriptPath%\custom_ins_dir\custom.ins"
endif
Files_del_profile_temp
endif
endif
[Files_copy_profile_temp]
copy -s "%SCRIPTPATH%\profile.temp\*.*" "$TEMP$\profile.temp"
[Files_del_profile_temp]
delete -sf "$TEMP$\profile.temp"
[Registry_delete_current_version]
OpenKey [HKEY_LOCAL_MACHINE\Software\Mozilla\Mozilla Thunderbird]
set "CurrentVersion" = ""
[Winbatch_start_taskmgr_for_debug]
taskmgr.exe
[Winbatch_thunderbird_silent_install_2]
"%SCRIPTPATH%\Thunderbird Setup 2.0.0.24.exe" /S
[Winbatch_thunderbird_silent_install_3]
"%SCRIPTPATH%\Thunderbird Setup 3.0.4.exe" -ms -ira
[WinBatch_install_enigmail_de2]
"%ProgramFilesDir%\Mozilla Thunderbird\thunderbird.exe" -profile "$TEMP$\profile.temp" -install-global-extension %ScriptPath%\extensions\enigmail-0.96.0-tb+sm-win.xpi
[WinBatch_install_enigmail_de3]
"%ProgramFilesDir%\Mozilla Thunderbird\thunderbird.exe" -profile "$TEMP$\profile.temp" -install-global-extension %ScriptPath%\extensions\enigmail-1.0-tb-win.xpi
[WinBatch_install_dictionary_de2]
"%ProgramFilesDir%\Mozilla Thunderbird\thunderbird.exe" -profile "$TEMP$\profile.temp" -install-global-extension %ScriptPath%\extensions\deutsches_woerterbuch-1.0.2-fx+tb+sm.xpi
[WinBatch_install_dictionary_de3]
"%ProgramFilesDir%\Mozilla Thunderbird\thunderbird.exe" -profile "$TEMP$\profile.temp" -install-global-extension %ScriptPath%\extensions\german_dictionary-2.0.1-fx+tb+sm+fn.xpi
[WinBatch_install_lightning2]
"%ProgramFilesDir%\Mozilla Thunderbird\thunderbird.exe" -profile "$TEMP$\profile.temp" -install-global-extension %ScriptPath%\extensions\lightning-0.9-tb-win.xpi
[WinBatch_install_lightning3]
"%ProgramFilesDir%\Mozilla Thunderbird\thunderbird.exe" -profile "$TEMP$\profile.temp" -install-global-extension %ScriptPath%\extensions\lightning-1.0b1-tb+sm-win.xpi
[DosInAnIcon_sleep]
"%ScriptPath%\sleep" 20
[dosbatch_profiledir]
@echo off
dir "%ProfileDir%" /b
[sub_patch_prefs_file]
Set $akt_profile_ini$ = "%ProfileDir%\"+"$x$"+"\Anwendungsdaten\Thunderbird\profiles.ini"
if FileExists($akt_profile_ini$)
Set $rel_prefs_path$ = GetIni ($akt_profile_ini$ [Profile0] Path)
Set $akt_prefs_path$ = "%ProfileDir%\"+"$x$"+"\Anwendungsdaten\Thunderbird\"+$rel_prefs_path$
if FileExists($akt_prefs_path$+"\prefs.js")
PatchTextFile_profile_noautoupdate $akt_prefs_path$+"\prefs.js"
endif
endif
[PatchTextFile_profile_noautoupdate]
Set_Netscape_User_Pref ("app.update.enabled", false)
[DosInAnIcon_TryToReconnect]
net use
set TIMEOUT=
:TRY
if exist "%SCRIPTPATH%\." goto READY
%ScriptDrive%
set TIMEOUT=%TIMEOUT%1
if %TIMEOUT% == 1111111111111111 goto READY
sleep 1
net use
goto TRY
:READY
[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
endif
endif
endif
endif
*****************************************************************
delsub.ins
*****************************************************************
; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib
; and published under the Terms of the General Public License.
; Message at install time:
Message "Deinstalling Thunderbird ..."
; kill a running thunderbird
killtask "thunderbird.exe"
; if thunderbird 1.0.x uninstall program exist then start it
if FileExists("%SYSTEMROOT%\UninstallThunderbird.exe")
WinBatch_start_ThunderbirdUninstall
sub_check_exitcode
set $SearchProc$ = "UninstallThunderbird"
sub_wait_until_proc_finished
endif
; if thunderbird 1.5.x uninstall program exist then start it
Set $UninstallCommand$ = $MozInstallDir$ + "\uninstall\uninstall.exe"
if FileExists($UninstallCommand$)
Winbatch_uninstall_1_5
set $SearchProc$ = "uninstall"
sub_wait_until_proc_finished
endif
; if thunderbird 2.0.x or 3.0 uninstall program exist then start it
Set $UninstallCommand$ = $MozInstallDir$ + "\uninstall\helper.exe"
if FileExists($UninstallCommand$)
Winbatch_uninstall_2_3
endif
; delete registry entry to the current installed version
Registry_delete_current_version
; delete files of current version
Files_delete
[sub_wait_until_proc_finished]
set $ProcFound$="1"
set $TimeOut$="0"
set $TimeOutList$= createStringList("0","1","2","3","4","5","6","7","8","end")
for %t% in $TimeOutList$ do sub_proclook_and_wait
[sub_proclook_and_wait]
if ($TimeOut$="0") and ($ProcFound$="1")
set $ProcFound$="0"
set $ProcessList$ = getOutStreamFromSection('DosBatch_pslist')
LogLevel = -2
for %s% in $ProcessList$ do sub_find_proc
LogLevel = 2
if ("%t%"="end")
set $TimeOut$="1"
endif
if ($TimeOut$="0") and ($ProcFound$="1")
DosInAnIcon_sleep_2
endif
if ($TimeOut$="1") and ($ProcFound$="1")
killtask $SearchProc$+".exe"
DosInAnIcon_sleep_2
; ExitWindows /ImmediateReboot
endif
endif
[sub_find_proc]
if ($ProcFound$="0")
if takestring(0, splitStringOnWhitespace ("%s%")) = $SearchProc$
set $ProcFound$="1"
endif
endif
[DosBatch_pslist]
@echo off
%ScriptPath%\pslist /accepteula
[DosInAnIcon_sleep_2]
%ScriptPath%\sleep 2
[WinBatch_start_ThunderbirdUninstall]
%SYSTEMROOT%\UninstallThunderbird.exe /ma
[Winbatch_uninstall_1_5]
"$UninstallCommand$" /ma
[Winbatch_uninstall_2_3]
"$UninstallCommand$" /S
[Files_delete]
delete -sf "$MozInstallDir$"
[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
endif
endif
endif
endif
**************************************************************
delthunderbird.ins
**************************************************************
; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib
; and published under the Terms of the General Public License.
[Initial]
; Message at install time:
Message=Installiere Thunderbird...
LogLevel=2
; Log Errors in Logfile but don't abort:
ExitOnError=false
; Show syntax errors in the script:
ScriptErrorMessages=on
; Dont trace step by step through the script:
TraceMode=off
; let started programs run in front of the winst window
StayOnTop=false
[Aktionen]
DefStringList $TimeOutList$
DefStringList $ProcessList$
DefVar $ProcFound$
DefVar $TimeOut$
DefVar $SearchProc$
DefVar $UninstallCommand$
DefVar $PRODUCTPATH$
DefStringList $profiles$
DefVar $akt_profile_ini$
DefVar $rel_prefs_path$
DefVar $akt_prefs_path$
DefVar $OS$
DefVar $TEMP$
DefVar $NewExe$
Set $TEMP$ = EnvVar("TEMP")
Set $PRODUCTPATH$="%ProgramFilesDir%\Mozilla Thunderbird"
set $NewExe$= $PRODUCTPATH$+"\thunderbird.exe"
set $OS$ = GetOS
; is this a win32 system ?
if ( $OS$ = "Windows_NT" OR $OS$ = "Windows_95" )
if not(HasMinimumSpace ("%SYSTEMDRIVE%", "1 MB"))
LogError "Nicht genuegend Platz auf C: . 1 MB auf C: fuer Thunderbird erforderlich."
isFatalError
; Bearbeitung beenden und Produktschalter auf failed setzen
else
; show product picture
ShowBitmap /3 "%scriptpath%\thunderbird.png" "Thunderbird"
DefVar $MozInstallDir$
DefVar $MozVersion$
DefVar $MozInstallPathRegKey$
set $MozVersion$ = GetRegistryStringValue ("[HKEY_LOCAL_MACHINE\Software\Mozilla\Mozilla Thunderbird] CurrentVersion")
set $MozInstallPathRegKey$ = "[HKEY_LOCAL_MACHINE\Software\Mozilla\Mozilla Thunderbird\"+$MozVersion$+"\Main]"
set $MozInstallDir$ = GetRegistryStringValue ($MozInstallPathRegKey$+" Install Directory")
if FileExists("%ScriptPath%\delsub.ins")
; start uninstall
sub "%ScriptPath%\delsub.ins"
endif
endif
endif