===== Winst-Script for Mozilla Thunderbird =====
by Sven Noherr
Dieses Script installiert Mozilla Thunderbird und deaktiviert die Suche nach neuen Updates.
==== Struktur ====
+-files\ +-mozilla.cfg
| +-Thunderbird-Setup-24.6.0.exe
+-a_defaults.ins
+-setup.ins
+-sub_exitcode.ins
+-sub_uninstall.ins
+-thunderbird.png
+-uninstall.ins
==== files\mozilla.cfg ====
//
lockPref("app.update.enabled", false);
==== a_defaults.ins ====
Dieses Skript muss als einziges "geändert" werden, wenn ein Update erscheint.
DefVar $MsiId$
DefVar $Version$
DefVar $UninstallProgram$
DefVar $LogDir$
DefVar $ProductId$
DefVar $MinimumSpace$
DefVar $InstallDir$
DefVar $ExitCode$
Set $LogDir$ = "%SystemDrive%\tmp"
; Diesen Wert bei einer neuen Version ändern
Set $Version$ = "24.6.0"
Set $ProductId$ = "thunderbird"
Set $MinimumSpace$ = "50 MB"
Set $InstallDir$ = "%ProgramFiles32Dir%\Mozilla Thunderbird"
==== setup.ins ====
[Actions]
requiredWinstVersion >= "4.11.2.6"
if FileExists("%ScriptPath%\a_defaults.ins")
Sub "%ScriptPath%\a_defaults.ins"
else
logError "Fatal: a_defaults.ins nicht vorhanden!!!"
isFatalError "a_defaults.ins nicht vorhanden!!!"
endif
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%\sub_uninstall.ins")
comment "Start uninstall sub section"
Sub "%ScriptPath%\sub_uninstall.ins"
endif
Message "Installing " + $ProductId$ + " ..."
comment "Start setup program"
ChangeDirectory "%SCRIPTPATH%"
killtask "thunderbird.exe"
Winbatch_install
Sub_check_exitcode
PatchTextFile_noupdate $InstallDir$+"\defaults\pref\channel-prefs.js"
Files_install
endif
[Winbatch_install]
"%ScriptPath%\files\Thunderbird-Setup-$Version$.exe" -ms
[PatchTextFile_noupdate]
Set_Mozilla_Pref("pref","general.config.obscure_value", 0)
Set_Mozilla_Pref("pref","general.config.filename", "mozilla.cfg")
[Files_install]
copy "%ScriptPath%\files\mozilla.cfg" $InstallDir$
[Sub_check_exitcode]
if FileExists("%ScriptPath%\sub_exitcode.ins")
Sub "%ScriptPath%\sub_exitcode.ins"
endif
==== sub_exitcode.ins ====
Da dieser Code-Schnipsel mehrfach gebraucht wird, habe ich ihn einfach als Sub ausgelagert.
set $ExitCode$ = getLastExitCode
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
==== sub_uninstall.ins ====
Set $UninstallProgram$ = $InstallDir$ + "\uninstall\helper.exe"
Message "Uninstalling " + $ProductId$ + " ..."
if FileExists($UninstallProgram$)
comment "Uninstall program found, starting uninstall"
Winbatch_uninstall
sub_check_exitcode
endif
[Winbatch_uninstall]
"$UninstallProgram$" -ms
[Sub_check_exitcode]
if FileExists("%ScriptPath%\sub_exitcode.ins")
Sub "%ScriptPath%\sub_exitcode.ins"
endif
==== uninstall.ins ====
[Actions]
requiredWinstVersion >= "4.11.2.6"
if FileExists("%ScriptPath%\a_defaults.ins")
Sub "%ScriptPath%\a_defaults.ins"
else
logError "Fatal: a_defaults.ins nicht vorhanden!!!"
isFatalError "a_defaults.ins nicht vorhanden!!!"
endif
comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
Message "Uninstalling " + $ProductId$ + " ..."
if FileExists("%ScriptPath%\sub_uninstall.ins")
comment "Start uninstall sub section"
Sub "%ScriptPath%\sub_uninstall.ins"
endif