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

Install rust to fix cryptography build

This commit is contained in:
Josué Tille 2021-02-13 12:01:26 +01:00
parent 247899a139
commit ce034fb750
No known key found for this signature in database
GPG key ID: 716A6C99B04194EF
2 changed files with 28 additions and 13 deletions

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
#=================================================