1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/synapse_ynh.git synced 2024-09-03 20:26:38 +02:00

Merge pull request #238 from YunoHost-Apps/fix_crypto_build

Install rust to fix cryptography build
This commit is contained in:
Josue-T 2021-02-16 20:03:52 +01:00 committed by GitHub
commit 2f7be07f5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 17 deletions

View file

@ -12,8 +12,8 @@
setup_private=0
setup_public=1
upgrade=1
upgrade=1 from_commit=fcbe10716aa2f9edbfc681093ca0d1f70903774b
upgrade=1 from_commit=5006cf1536f33d065aade2caa9b88120e0d1a381
upgrade=1 from_commit=0705f4ffb4f7538a1aa33a801f95766ee23367db
upgrade=1 from_commit=35774cc0eabb82b03230210689fa060d5f2b0bd8
backup_restore=1
multi_instance=1
incorrect_path=0
@ -22,7 +22,7 @@
;;; Levels
Level 5=auto
;;; Upgrade options
; commit=fcbe10716aa2f9edbfc681093ca0d1f70903774b
; commit=0705f4ffb4f7538a1aa33a801f95766ee23367db
name=Fix postgresql helper from old_version_for_CI_2 branch
; commit=5006cf1536f33d065aade2caa9b88120e0d1a381
; commit=35774cc0eabb82b03230210689fa060d5f2b0bd8
name=Migrate from self signed certificate to cert managed by Yunohost from old_version_for_CI_3 branch

View file

@ -10,6 +10,8 @@ install_sources() {
fi
mkdir -p $final_path
chown $synapse_user:root -R $final_path
chown $synapse_user:root -R $data_path
if [ -n "$(uname -m | grep arm)" ]
then
@ -28,6 +30,19 @@ install_sources() {
fi
done
else
# Install rustup is not already installed
# We need this to be able to install cryptgraphy
export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin"
if [ -e $final_path/.rustup ]; then
sudo -u "$synapse_user" env PATH=$PATH rustup update
else
sudo -u "$synapse_user" bash -c 'curl -sSf -L https://static.rust-lang.org/rustup.sh | sh -s -- -y --default-toolchain=stable'
mv $data_path/.cargo $final_path/
mv $data_path/.rustup $final_path/
ln -s $final_path/.cargo $data_path/.cargo
ln -s $final_path/.rustup $data_path/.rustup
fi
# Install virtualenv if it don't exist
test -e $final_path/bin/python3 || python3 -m venv $final_path
@ -39,8 +54,10 @@ install_sources() {
source $final_path/bin/activate
set -u;
pip3 install --upgrade setuptools wheel
chown $synapse_user:root -R $final_path
sudo -u $synapse_user env PATH=$PATH pip3 install --upgrade 'cryptography>=3.3'
pip3 install --upgrade cffi ndg-httpsclient psycopg2 lxml jinja2
pip3 install --upgrade 'Twisted>=20.3.0' 'cryptography>=3.3' matrix-synapse==$upstream_version matrix-synapse-ldap3
pip3 install --upgrade 'Twisted>=20.3.0' matrix-synapse==$upstream_version matrix-synapse-ldap3
# This function was defined when we called "source $final_path/bin/activate". With this function we undo what "$final_path/bin/activate" does
set +u;

View file

@ -72,6 +72,16 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=70
# For any update do it in all files
ynh_install_app_dependencies $dependances
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=3
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$synapse_user --home_dir=$data_path
adduser $synapse_user ssl-cert
adduser turnserver ssl-cert
#=================================================
# RESTORE ALL CONFIG AND DATA
#=================================================
@ -92,18 +102,6 @@ install_sources
ynh_script_progression --message="Reload fail2ban..." --weight=6
ynh_systemd_action --action=restart --service_name=fail2ban
#=================================================
# SPECIFIC RESTORATION
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=3
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$synapse_user --home_dir=$data_path
adduser $synapse_user ssl-cert
adduser turnserver ssl-cert
#=================================================
# RESTORE THE POSTGRESQL DATABASE
#=================================================