thunderbird 2.07 KB
Newer Older
kytv's avatar
kytv committed
1
2
3
#!/bin/sh

set -e
4
set -u
anonym's avatar
anonym committed
5
set -x
6

7
8
9
# Import set_mozilla_pref()
. /usr/local/lib/tails-shell-library/tor-browser.sh

10
11
THUNDERBIRD_CONFIG_DIR="${HOME}/.thunderbird"
PROFILE="${THUNDERBIRD_CONFIG_DIR}/profile.default"
kytv's avatar
kytv committed
12

13
14
15
16
17
18
19
20
21
22
23
24
25
26
configure_locale() {
    # Thunderbird will set the locale based on the environment when
    # this pref is empty, but will then save the result to this pref
    # disabling this "guess" for the next time. We want Thunderbird to
    # always match the locale of the Tails session.
    set_mozilla_pref "${PROFILE}/prefs.js"   \
                     "intl.locale.requested" \
                     '""'                    \
                     user_pref
}

reconfigure_profile() {
    mkdir -p "${PROFILE}"
    configure_locale
27
28
}

29
native_openpgp_configured() {
anonym's avatar
anonym committed
30
    grep -q -E '^user_pref\("mail\.identity\.id[0-9]+\.openpgp_key_id"' \
31
32
33
34
         "${PROFILE}/prefs.js"
}

enigmail_configured() {
anonym's avatar
anonym committed
35
    grep -q -E '^user_pref\("mail\.identity\.id[0-9]+\.enablePgp", true\);' \
36
37
38
39
         "${PROFILE}/prefs.js"
}

notify_enigmail_migration() {
intrigeri's avatar
Lint    
intrigeri committed
40
41
    local dialog_msg open_docs ignore
    dialog_msg="<b><big>$(gettext "You need to migrate your OpenPGP keys")</big></b>
42

intrigeri's avatar
Lint    
intrigeri committed
43
$(gettext "<i>Thunderbird</i> 78 now replaces the <i>Enigmail</i> extension with built-in support for OpenPGP encryption. To continue using your OpenPGP keys in <i>Thunderbird</i>, follow our migration instructions.")
44
"
intrigeri's avatar
Lint    
intrigeri committed
45
46
    open_docs=$(gettext "_Open Migration Instructions")
    ignore=$(gettext "_Migrate Later")
sajolida's avatar
sajolida committed
47
    zenity --question --width 480 --title "OpenPGP Migration" --text "${dialog_msg}" \
48
49
50
51
52
53
54
55
56
57
58
59
           --ok-label "${open_docs}" --cancel-label "${ignore}"
}

enigmail_migration() {
    if native_openpgp_configured || ! enigmail_configured; then
        return
    fi
    if notify_enigmail_migration; then
        tails-documentation doc/anonymous_internet/thunderbird/openpgp_migration &
    fi
}

60
start_thunderbird() {
61
    export GNOME_ACCESSIBILITY=1
kytv's avatar
kytv committed
62
    unset SESSION_MANAGER
63
    reconfigure_profile
64
    enigmail_migration
65
    exec /usr/bin/thunderbird --class "Thunderbird" -profile "${PROFILE}" "${@}"
kytv's avatar
kytv committed
66
67
}

68
start_thunderbird "${@}"