-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththunderbird_sequoia_installation.sh
More file actions
executable file
·114 lines (94 loc) · 3.01 KB
/
Copy paththunderbird_sequoia_installation.sh
File metadata and controls
executable file
·114 lines (94 loc) · 3.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
OCTOPUS_SRC_DIR="${SCRIPT_DIR}/sequoia-octopus-librnp"
OCTOPUS_REPO_URL="https://gitlab.com/sequoia-pgp/sequoia-octopus-librnp.git"
if [[ "${EUID}" -eq 0 ]]; then
echo "Run this script as a regular user (it will use sudo when needed)."
exit 1
fi
if [[ ! -r /etc/os-release ]]; then
echo "Cannot detect OS: /etc/os-release not found."
exit 1
fi
source /etc/os-release
if [[ "${ID:-}" != "pop" && "${ID_LIKE:-}" != *"ubuntu"* ]]; then
echo "This script targets Pop!_OS / Ubuntu-based systems."
echo "Detected: ID=${ID:-unknown} ID_LIKE=${ID_LIKE:-unknown}"
exit 1
fi
if ! command -v sudo >/dev/null 2>&1; then
echo "sudo is required."
exit 1
fi
echo "==> Installing Thunderbird and build dependencies"
sudo apt-get update
NETTLE_DEV_PKG=""
if apt-cache show nettle-dev >/dev/null 2>&1; then
NETTLE_DEV_PKG="nettle-dev"
elif apt-cache show libnettle-dev >/dev/null 2>&1; then
NETTLE_DEV_PKG="libnettle-dev"
else
echo "Could not find a Nettle development package (nettle-dev/libnettle-dev)."
exit 1
fi
sudo apt-get install -y \
thunderbird \
cargo \
clang \
git \
pkg-config \
"${NETTLE_DEV_PKG}" \
libssl-dev
if [[ ! -d "${OCTOPUS_SRC_DIR}" ]]; then
echo "==> Octopus source directory not found: ${OCTOPUS_SRC_DIR}"
echo "==> Cloning ${OCTOPUS_REPO_URL}"
git clone "${OCTOPUS_REPO_URL}" "${OCTOPUS_SRC_DIR}"
fi
echo "==> Building sequoia-octopus-librnp from ${OCTOPUS_SRC_DIR}"
pushd "${OCTOPUS_SRC_DIR}" >/dev/null
cargo build --release
popd >/dev/null
OCTOPUS_LIB="${OCTOPUS_SRC_DIR}/target/release/libsequoia_octopus_librnp.so"
if [[ ! -f "${OCTOPUS_LIB}" ]]; then
echo "Build succeeded, but library not found: ${OCTOPUS_LIB}"
exit 1
fi
echo "==> Detecting Thunderbird distribution directory"
TB_DIR=""
for candidate in \
/usr/lib/thunderbird \
/usr/lib64/thunderbird \
/opt/thunderbird
do
if [[ -d "${candidate}" ]]; then
TB_DIR="${candidate}"
break
fi
done
if [[ -z "${TB_DIR}" ]]; then
echo "Thunderbird install directory not found."
exit 1
fi
TB_LIBRNP="${TB_DIR}/librnp.so"
TB_LIBRNP_ORIG="${TB_DIR}/librnp-orig.so"
TB_OCTOPUS_LIB="${TB_DIR}/libsequoia_octopus_librnp.so"
echo "==> Installing Octopus library to ${TB_OCTOPUS_LIB}"
sudo install -m 0755 "${OCTOPUS_LIB}" "${TB_OCTOPUS_LIB}"
if ! dpkg-divert --list "${TB_LIBRNP}" | grep -q .; then
echo "==> Diverting original librnp.so to ${TB_LIBRNP_ORIG}"
sudo dpkg-divert --divert "${TB_LIBRNP_ORIG}" --rename "${TB_LIBRNP}"
else
echo "==> Existing diversion found for ${TB_LIBRNP}"
fi
echo "==> Pointing Thunderbird to Octopus backend"
sudo ln -sfn "libsequoia_octopus_librnp.so" "${TB_LIBRNP}"
echo
echo "Installation finished."
echo "- Thunderbird installed via apt"
echo "- Octopus library installed at ${TB_OCTOPUS_LIB}"
echo "- ${TB_LIBRNP} now points to libsequoia_octopus_librnp.so"
echo "- Original Thunderbird library preserved at ${TB_LIBRNP_ORIG}"
echo
echo "Important: Thunderbird updates may overwrite this setup."
echo "If that happens, rerun this script."