Thunderbird: Fix regression in defaultprotocol handling (refs: #15091).
[tails.git] / config / chroot_local-includes / usr / local / bin / thunderbird
blobeb4e589bd40e1cc2c02550ebb54a91b04aa63bbd
1 #!/bin/sh
3 set -e
4 set -u
5 set -x
7 # Import set_mozilla_pref()
8 . /usr/local/lib/tails-shell-library/tor-browser.sh
10 # Import guess_best_thunderbird_locale():
11 . /usr/local/lib/tails-shell-library/thunderbird.sh
13 THUNDERBIRD_CONFIG_DIR="${HOME}/.thunderbird"
14 PROFILE="${THUNDERBIRD_CONFIG_DIR}/profile.default"
16 thunderbird_config_is_persistent() {
17 [ "$(findmnt --noheadings --output SOURCE --target "${THUNDERBIRD_CONFIG_DIR}")" = "/dev/mapper/TailsData_unlocked[/thunderbird]" ]
20 configure_default_incoming_protocol() {
21 # For extensions.torbirdy.defaultprotocol, POP = 0, IMAP = 1
22 local default_protocol
23 if thunderbird_config_is_persistent; then
24 default_protocol=0
25 else
26 default_protocol=1
28 mkdir -p "${PROFILE}"
29 set_mozilla_pref "${PROFILE}/prefs.js" \
30 "extensions.torbirdy.defaultprotocol" \
31 "${default_protocol}" \
32 user_pref
35 configure_best_thunderbird_locale() {
36 local locale
37 locale=$(guess_best_thunderbird_locale)
38 mkdir -p "${PROFILE}"
39 set_mozilla_pref "${PROFILE}/prefs.js" \
40 "intl.locale.requested" \
41 "\"${locale}\"" \
42 user_pref
45 start_thunderbird() {
46 export GNOME_ACCESSIBILITY=1
47 unset SESSION_MANAGER
49 configure_default_incoming_protocol
51 configure_best_thunderbird_locale
53 exec /usr/bin/thunderbird --class "Thunderbird" -profile "${PROFILE}" "${@}"
56 start_thunderbird "${@}"