pantalaimon-ut/dev-build.sh
Morgan McMillian 91309d6ac7 pin python cryptography to 3.2.1
This is the last version of python cryptography that will cleanly
build on Ubuntu Touch 16.04. The 3.3 series depends on newer openssl and
the 3.4 series depends on Rust.
2021-02-09 12:07:15 -08:00

97 lines
2.8 KiB
Bash
Executable file

#!/bin/bash
PROJECT_DIR=~/pantalaimon-build
TMP_DIR="${PROJECT_DIR}/tmp"
VIRTENV_DIR="${PROJECT_DIR}/virtenv"
OLM_DIR="${PROJECT_DIR}/olm"
PANTALAIMON_DIR="${PROJECT_DIR}/pantalaimon"
PYTHON_VERSION_MINOR="3.7"
PYTHON_VERSION_PATCH="7"
PYTHON_VERSION="${PYTHON_VERSION_MINOR}.${PYTHON_VERSION_PATCH}"
PYTHON_DIR="${PROJECT_DIR}/python"
PYTHON_SRC_DIR="${TMP_DIR}/Python-${PYTHON_VERSION}"
PYTHON="${PYTHON_DIR}/bin/python${PYTHON_VERSION_MINOR}"
mkdir -p "${PROJECT_DIR}"
mkdir -p "${TMP_DIR}"
PACKAGES="make cmake build-essential zlibc python3-venv libffi-dev ppa-purge libssl-dev libsqlite3-dev"
PANTALAIMON_PATCH_CONTENT="
diff --git a/pantalaimon/main.py b/pantalaimon/main.py
index 896d29e..3e0fee8 100644
--- a/pantalaimon/main.py
+++ b/pantalaimon/main.py
@@ -32,6 +32,7 @@ from pantalaimon.log import logger
from pantalaimon.thread_messages import DaemonResponse
from pantalaimon.ui import UI_ENABLED
+keyring.core.set_keyring(keyring.core.load_keyring('keyring.backends.SecretService.Keyring'))
def create_dirs(data_dir, conf_dir):
try:
"
echo "Remounting RootFS writable..."
sudo mount -o remount,rw /
echo "Installing dependencies..."
sudo apt update
sudo apt install -y ${PACKAGES}
if [ ! -e "${OLM_DIR}/usr/local/lib/libolm.so" ]; then
cd "${TMP_DIR}"
echo "Downloading Olm..."
wget -qO- "https://gitlab.matrix.org/matrix-org/olm/-/archive/master/olm-master.tar.gz" | tar -xz
echo "Building Olm..."
cd olm-master
cmake . -Bbuild
cmake --build build
echo "Installing Olm..."
cd build
make install DESTDIR="${OLM_DIR}"
else
echo "Olm found. Skipping Olm Install..."
fi
if [ ! -e "${PYTHON}" ]; then
echo "Downloading Python..."
cd "${TMP_DIR}"
wget -qO- "https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz" | tar -xz
echo "Installing Python..."
cd "${PYTHON_SRC_DIR}"
./configure --prefix="${PYTHON_DIR}" --enable-shared
make
make install
else
echo "Python found. Skipping Python Install..."
fi
LD_LIBRARY_PATH=${PYTHON_DIR}/lib:${OLM_DIR}/usr/local/lib:${LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
echo "Installing PyInstaller..."
${PYTHON} -m pip install --upgrade pyinstaller
echo "Installing cryptography 3.2.1"
${PYTHON} -m pip install cryptography==3.2.1
echo "Installing Pantalaimon..."
CFLAGS=-I"${OLM_DIR}/usr/local/include -I${OLM_DIR}/usr/local/include" LDFLAGS="-L${OLM_DIR}/usr/local/lib" ${PYTHON} -m pip install --upgrade pantalaimon
echo "Bundling Pantalaimon..."
cd ${PROJECT_DIR}
echo "${PANTALAIMON_PATCH_CONTENT}" > main.patch
patch ${PYTHON_DIR}/lib/python${PYTHON_VERSION_MINOR}/site-packages/pantalaimon/main.py main.patch
${PYTHON_DIR}/bin/pyinstaller --onefile ${PYTHON_DIR}/bin/pantalaimon
echo "Cleaning up, reverting changes to RootFS..."
sudo apt autoremove -y ${PACKAGES}
sudo apt clean