Reclaim Your Inbox
Thunderbirdin asennus kopioi levylle paljon ylimääräistä rojua, jota ei paketoinnissa haluta saada pakettiin.
Profiilit luodaan samalla tavalla kuin Firefox-paketissa, käyttäen Active Setuppia, mutta profiiliskripti on hieman erilainen. Profiilissa on tarpeellista määritellä mailipalvelimet ja käyttäjän nimi yms. tiedot, jotka skripti hakee LDAP-serveriltä. Jos käyttäjällä on jo profiili, sieltä otetaan tarpeellinen data talteen ja se kopioidaan uuteen prefs.js-tiedostoon. Lopuksi skripti vielä päivittää HKCU\SOFTWARE\Clients\Mail
-registryasetuksen oikeaan arvoon.
Alla skripti:
' Mozilla Thunderbirdin starttiskripti ' veijo@utu.fi / 28.8.2002 ' mikko@utu.fi / 2.7.2005 Muokattu Mozilla Thunderbirdille ' vvirta@utu.fi / 8.3.2006 Päivitetty Thunderbird 1.5 varten ' vvirta@utu.fi / 10.5.2006 Muutettu Active Setupissa ajettavaksi skriptiksi Thunderbird 1.5.0.2-pakettia varten Set shell = CreateObject("WScript.Shell") Set env = shell.Environment("process") Set fs = CreateObject("Scripting.FileSystemObject") Set cmdArgs = WScript.Arguments Set AppsFolder = fs.GetFolder(env("APPDATA")) Set ProgFolder = fs.GetFolder(env("ProgramFiles")) CertName = (ProgFolder & "\mozilla.org\Thunderbird\cert8.db") Function latin2utf8(Characters) ' Converts Latin String to UTF-8 ' Input: String (Latin) ' Ouput: String (UTF-8) For counter = 1 to Len(Characters) CurrChar = Right(Left(Characters, counter), 1) c = Asc(CurrChar) If (c And 128) = 0 Then latin2utf8 = latin2utf8 & CurrChar Else latin2utf8 = latin2utf8 & Chr(192 Or (3 And Int(c / 64))) latin2utf8 = latin2utf8 & Chr(128 Or (63 And c)) End If Next End Function If Not fs.folderexists (AppsFolder & "\Thunderbird\Profiles\") Then ' Ajetaan profiilimanageri shell.Run (chr(34) & ProgFolder & "\mozilla.org\Thunderbird\thunderbird.exe" & chr(34) & " -CreateProfile " & env("USERNAME")),2,TRUE ' Haetaan asetuskansion nimi Set UserFolder = fs.GetFolder(AppsFolder & "\Thunderbird\Profiles") For Each DestFolder in UserFolder.SubFolders Set con = CreateObject("ADODB.Connection") con.Provider = "ADsDSOObject" con.open Set command = CreateObject("ADODB.Command") Set command.ActiveConnection = con ' Haetaan käyttäjän tiedot command.CommandText = "<LDAP://DC=utu,DC=fi>;(&(objectCategory=Person)(samaccountname=" & env("USERNAME") & "));distinguishedname;subtree" Set rs = command.Execute Set UserObject = GetObject("LDAP://" & ((rs("distinguishedname")))) ' Kopioidaan sertifikaatti käyttäjälle Set certCopy = fs.GetFile(CertName) certCopy.Copy(DestFolder & "\cert8.db") ' Rakennetaan konffitiedosto Set ConfFile = fs.CreateTextFile(Destfolder & "\prefs.js",TRUE) ConfFile.WriteLine "# Mozilla User Preferences" ConfFile.WriteLine "/* Do not edit this file." ConfFile.WriteLine "" ConfFile.WriteLine " *" ConfFile.WriteLine " * If you make changes to this file while the browser is running," ConfFile.WriteLine " * the changes will be overwritten when the browser exits." ConfFile.WriteLine " *" ConfFile.WriteLine " * To make a manual change to preferences, you can visit the URL about:config" ConfFile.WriteLine " * For more information, see http://www.mozilla.org/unix/customizing.html#prefs" ConfFile.WriteLine " */" ConfFile.WriteLine "" ConfFile.WriteLine "user_pref(" & chr(34) & "app.update.enabled" & chr(34) & ", false);" ConfFile.WriteLine "user_pref(" & chr(34) & "ldap_2.autoComplete.directoryServer" & chr(34) & ", " & chr(34) & "ldap_2.servers.UtuLDAP" & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "ldap_2.autoComplete.useDirectory" & chr(34) & ", true);" ConfFile.WriteLine "user_pref(" & chr(34) & "ldap_2.prefs_migrated" & chr(34) & ", true);" ConfFile.WriteLine "user_pref(" & chr(34) & "ldap_2.servers.UtuLDAP.auth.dn" & chr(34) & ", " & chr(34) & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "ldap_2.servers.UtuLDAP.auth.savePassword" & chr(34) & ", true);" ConfFile.WriteLine "user_pref(" & chr(34) & "ldap_2.servers.UtuLDAP.description" & chr(34) & ", " & chr(34) & "Utu LDAP" & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "ldap_2.servers.UtuLDAP.uri" & chr(34) & ", " & chr(34) & "ldap://ldap.utu.fi:389/dc=utu,dc=fi??sub" & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.account.account1.identities" & chr(34) & ", " & chr(34) & "id1" & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.account.account1.server" & chr(34) & ", " & chr(34) & "server1" & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.account.account2.server" & chr(34) & ", " & chr(34) & "server2" & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.accountmanager.accounts" & chr(34) & ", " & chr(34) & "account1,account2" & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.accountmanager.defaultaccount" & chr(34) & ", " & chr(34) & "account1" & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.accountmanager.localfoldersserver" & chr(34) & ", " & chr(34) & "server2" & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.checkDefaultMail" & chr(34) & ", false);" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.checkDefaultNews" & chr(34) & ", false);" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.checkDefaultFeed" & chr(34) & ", false);" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.collect_email_address_outgoing" & chr(34) & ", false);" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.default_html_action" & chr(34) & ", 1);" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.display_glyph" & chr(34) & ", false);" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.enable_autocomplete" & chr(34) & ", false);" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.forward_message_mode" & chr(34) & ", 2);" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.identity.id1.bcc_other_list" & chr(34) & ", " & chr(34) & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.identity.id1.compose_html" & chr(34) & ", false);" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.identity.id1.draft_folder" & chr(34) & ", " & chr(34) & "imap://" & UserObject.sAMAccountName & "@imap.utu.fi/Drafts" & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.identity.id1.drafts_folder_picker_mode" & chr(34) & ", 0);" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.identity.id1.fcc_folder" & chr(34) & ", " & chr(34) & "imap://" & UserObject.sAMAccountName & "@imap.utu.fi/Sent" & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.identity.id1.fcc_folder_picker_mode" & chr(34) & ", 0);" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.identity.id1.stationery_folder" & chr(34) & ", " & chr(34) & "imap://" & UserObject.sAMAccountName & "@imap.utu.fi/Templates" & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.identity.id1.tmpl_folder_picker_mode" & chr(34) & ", 0);" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.identity.id1.fullName" & chr(34) & ", " & chr(34) & latin2utf8(UserObject.fullName) & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.identity.id1.organization" & chr(34) & ", " & chr(34) & "University of Turku" & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.identity.id1.smtpServer" & chr(34) & ", " & chr(34) & "smtp1" & chr(34) & ");" If UserObject.mail = "" Then ConfFile.WriteLine "user_pref(" & chr(34) & "mail.identity.id1.useremail" & chr(34) & ", " & chr(34) & UserObject.sAMAccountname & "@utu.fi" & chr(34) & ");" Else ConfFile.WriteLine "user_pref(" & chr(34) & "mail.identity.id1.useremail" & chr(34) & ", " & chr(34) & UserObject.mail & chr(34) & ");" End If ConfFile.WriteLine "user_pref(" & chr(34) & "mail.identity.id1.valid" & chr(34) & ", " & chr(34) & "true" & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.server.server1.hostname" & chr(34) & ", " & chr(34) & "imap.utu.fi" & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.server.server1.isSecure" & chr(34) & ", true);" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.server.server1.login_at_startup" & chr(34) & ", true);" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.server.server1.name" & chr(34) & ", " & chr(34) & "imap.utu.fi" & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.server.server1.port" & chr(34) & ", " & chr(34) & "993" & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.server.server1.type" & chr(34) & ", " & chr(34) & "imap" & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.server.server1.userName" & chr(34) & ", " & chr(34) & UserObject.sAMAccountName & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.server.server1.check_time" & chr(34) & ", 30);" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.server.server2.hostname" & chr(34) & ", " & chr(34) & "Local Folders" & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.server.server2.name" & chr(34) & ", " & chr(34) & "Local Folders" & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.server.server2.type" & chr(34) & ", " & chr(34) & "none" & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.server.server2.userName" & chr(34) & ", " & chr(34) & "nobody" & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.smtp.defaultserver" & chr(34) & ", " & chr(34) & "smtp1" & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.smtpserver.smtp1.auth_method" & chr(34) & ", 0);" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.smtpserver.smtp1.hostname" & chr(34) & ", " & chr(34) & "smtp.utu.fi" & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.smtpserver.smtp1.try_ssl" & chr(34) & ", 1);" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.smtpserver.smtp1.username" & chr(34) & ", " & chr(34) & "" & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.smtpservers" & chr(34) & ", " & chr(34) & "smtp1" & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "mail.startup.enabledMailCheckOnce" & chr(34) & ", true);" ConfFile.WriteLine "user_pref(" & chr(34) & "mailnews.start_page.enabled" & chr(34) & ", false);" ConfFile.WriteLine "user_pref(" & chr(34) & "mailnews.send_default_charset" & chr(34) & ", " & chr(34) & "ISO-8859-15" & chr(34) & ");" ConfFile.WriteLine "user_pref(" & chr(34) & "mailnews.view_default_charset" & chr(34) & ", " & chr(34) & "ISO-8859-15" & chr(34) & ");" ConfFile.Close Next Else ' Korjataan prefs.js:ää Set UserFolder = fs.GetFolder(AppsFolder & "\Thunderbird\Profiles") For Each DestFolder in UserFolder.SubFolders prefFile = DestFolder & "\prefs.js" Set inStream = fs.OpenTextFile(prefFile) FileContents = inStream.ReadAll ' Kerätään tarvittavat tiedot Set objRegEx = New RegExp objRegEx.Global = True ObjRegEx.IgnoreCase = True objRegEx.Pattern = "user_pref\(" & chr(34) & "((ldap_2)|(mail)|(mailnews))\..+" & chr(34) & "\)\;" Set matches = objRegEx.Execute(FileContents) ' Kirjoitetaan prefs.js Set outStream = fs.OpenTextFile(prefFile, 2, True) outStream.WriteLine "# Mozilla User Preferences" outStream.WriteLine "/* Do not edit this file." outStream.WriteLine "" outStream.WriteLine " *" outStream.WriteLine " * If you make changes to this file while the browser is running," outStream.WriteLine " * the changes will be overwritten when the browser exits." outStream.WriteLine " *" outStream.WriteLine " * To make a manual change to preferences, you can visit the URL about:config" outStream.WriteLine " * For more information, see http://www.mozilla.org/unix/customizing.html#prefs" outStream.WriteLine " */" outStream.WriteLine "" For Each match in matches 'If Not InStr(1, match, "mail.checkDefault", 1) Then outStream.WriteLine match 'End If Next outStream.WriteLine "user_pref(" & chr(34) & "app.update.enabled" & chr(34) & ", false);" outStream.WriteLine "user_pref(" & chr(34) & "mail.checkDefaultMail" & chr(34) & ", false);" outStream.WriteLine "user_pref(" & chr(34) & "mail.checkDefaultNews" & chr(34) & ", false);" outStream.WriteLine "user_pref(" & chr(34) & "mail.checkDefaultFeed" & chr(34) & ", false);" Next End If ' Kirjoitetaan XP:n oletusmailiclientin arvo HKCU-hiveen shell.RegWrite "HKCU\SOFTWARE\Clients\Mail\", "Mozilla Thunderbird", "REG_SZ"
Kun Thunderbird asennetaan, halutaan se myös pistää oletusmailiohjelmaksi kaikille käyttäjille. Oletusmailiselain määritellään kahdesta asiasta.
Jos Thunderbirdin antaa itse asettaa itsensä oletusmailiohjelmaksi, se kirjoittaa seuraavat registryarvot 1):
Avain | Arvo |
---|---|
HKCR\mailto\shell\open\command | C:\PROGRA~1\MOZILLA.ORG\THUNDE~1\THUNDE~1.EXE -compose %1 |
HKLM\SOFTWARE\Clients\Mail | Mozilla Thunderbird |
HKCU\SOFTWARE\Clients\Mail | Mozilla Thunderbird |
HKLM\SOFTWARE\Classes\mailto\shell\open\command
-asetuksessa määritellään millä ohjelmalla avataan mailto-linkki. Tätä arvoa Thunderbird katsoo, kun se haluaa tietää onko se oletusmailiohjelma. Jos Thunderbirdin antaa itse kirjoittaa tämän arvon, se kirjoittaa siihen polun käyttäen lyhyita 8.3 tiedostonimiä. Koska tätä on vaikea tehdä asennuksessa oikein, on helpompaa disabloida Thunderbirdin tarkistus. Tämä käy suhteellisen monimutkaisesti.
user_pref(”mail.checkDefaultMail, false”);
HKLM\SOFTWARE\Mozilla Thunderbird\Desktop\defaultMailHasBeenSet
tulee asettaa arvoon ”0” (REG_SZ)HKLM\SOFTWARE\Mozilla Thunderbird\Desktop\showMapiDialog
tulee asettaa arvoon ”0” (REG_SZ)Tämän jälkeen mailto-arvoon voi kirjoittaa asennuksen yhteydessä polun rauhassa miettimättä onko se täsmälleen Thunderbirdin tarkistuksen mukainen.
Windows XP:ssä Start-valikossa näkyy valinta ”E-Mail”. Tätä arvoa kontrolloidaan arvolla HKCU\SOFTWARE\Clients\Mail
. Jos arvoa ei ole asetettu, oletusarvo haetaan polusta HKLM\SOFTWARE\Clients\Mail
. Arvona on HKLM\SOFTWARE\Clients\Mail
polusta löytyvä avain, jonka alla luetellaan sen mailiohjelman ominaisuudet.
Thunderbirdille riittää, että asetetaan jokaiselle käyttäjälle HKCU\SOFTWARE\Clients\Mail
arvoon Mozilla Thunderbird
ja lisäksi seuraavat arvot laitetaan registryyn:
<Registry Id="registry33" Action="write" Root="HKLM" Key="SOFTWARE\Clients\Mail\Mozilla Thunderbird" Value="Mozilla Thunderbird" Type="string" KeyPath="yes" /> <Registry Id="registry34" Action="write" Root="HKLM" Key="SOFTWARE\Clients\Mail\Mozilla Thunderbird" Name="DLLPath" Value=""[ProgramFilesFolder]mozilla.org\Thunderbird\mozMapi32.dll"" Type="string" /> <Registry Id="registry35" Action="write" Root="HKLM" Key="SOFTWARE\Clients\Mail\Mozilla Thunderbird\.eml" Value="Microsoft Internet Mail Message" Type="string" /> <Registry Id="registry36" Action="write" Root="HKLM" Key="SOFTWARE\Clients\Mail\Mozilla Thunderbird\.eml" Name="Content Type" Value="message/rfc822" Type="string" /> <Registry Id="registry37" Action="write" Root="HKLM" Key="SOFTWARE\Clients\Mail\Mozilla Thunderbird\.eml\ShellEx\{BB2E617C-0920-11d1-9A0B-00C04FC2D6C1}" Value="{EAB841A0-9550-11cf-8C16-00805F1408F3}" Type="string" /> <Registry Id="registry38" Action="write" Root="HKLM" Key="SOFTWARE\Clients\Mail\Mozilla Thunderbird\DefaultIcon" Value=""[ProgramFilesFolder]mozilla.org\Thunderbird\thunderbird.exe",0" Type="string" /> <Registry Id="registry39" Action="write" Root="HKLM" Key="SOFTWARE\Clients\Mail\Mozilla Thunderbird\InstallInfo" Name="HideIconsCommand" Value=""[ProgramFilesFolder]mozilla.org\Thunderbird\uninstall\uninstall.exe" /ua "1.5 (en-US)" /hs" Type="string" /> <Registry Id="registry40" Action="write" Root="HKLM" Key="SOFTWARE\Clients\Mail\Mozilla Thunderbird\InstallInfo" Name="IconsVisible" Value="0" Type="integer" /> <Registry Id="registry41" Action="write" Root="HKLM" Key="SOFTWARE\Clients\Mail\Mozilla Thunderbird\InstallInfo" Name="ReinstallCommand" Value=""[ProgramFilesFolder]mozilla.org\Thunderbird\thunderbird.exe" -silent -nosplash -setDefaultMail" Type="string" /> <Registry Id="registry42" Action="write" Root="HKLM" Key="SOFTWARE\Clients\Mail\Mozilla Thunderbird\InstallInfo" Name="ShowIconsCommand" Value=""[ProgramFilesFolder]mozilla.org\Thunderbird\uninstall\uninstall.exe" /ua "1.5 (en-US)" /ss mail" Type="string" /> <Registry Id="registry43" Action="write" Root="HKLM" Key="SOFTWARE\Clients\Mail\Mozilla Thunderbird\protocols\mailto" Value="URL:MailTo Protocol" Type="string" /> <Registry Id="registry44" Action="write" Root="HKLM" Key="SOFTWARE\Clients\Mail\Mozilla Thunderbird\protocols\mailto\DefaultIcon" Value=""[ProgramFilesFolder]mozilla.org\Thunderbird\thunderbird.exe",0" Type="string" /> <Registry Id="registry45" Action="write" Root="HKLM" Key="SOFTWARE\Clients\Mail\Mozilla Thunderbird\protocols\mailto\shell\open\command" Value=""[ProgramFilesFolder]mozilla.org\Thunderbird\thunderbird.exe" -compose %1" Type="string" /> <Registry Id="registry46" Action="write" Root="HKLM" Key="SOFTWARE\Clients\Mail\Mozilla Thunderbird\shell\open\command" Value=""[ProgramFilesFolder]mozilla.org\Thunderbird\thunderbird.exe" -mail" Type="string" /> <Registry Id="registry47" Action="write" Root="HKLM" Key="SOFTWARE\Clients\Mail\Mozilla Thunderbird\shell\properties\command" Value=""[ProgramFilesFolder]mozilla.org\Thunderbird\thunderbird.exe" -options" Type="string" />
Thunderbirdiin saa laajennuksia (eng. extensions), joita mahdollisesti halutaan asentaa ohjelman käyttöä varten. Turun Yliopistolla laajennuksista ”redirect”-toiminnon lisäävä laajennus halutaan käyttöön oletuksena kaikissa asennuksissa. Tämä tehdään siten, että testikoneelle asennetaan kyseinen laajennus, tämän jälkeen etsitään se käyttäjän Thunderbird-profiilin2) alta ja sieltä extensions-hakemistosta katsotaan oikea hakemisto. Tämän jälkeen koko hakemisto kopioidaan asennuspakettiin Thunderbirdin asennushakemiston alla olevaan extensions-hakemistoon. Näin laajennus tulee kaikille käyttöön.