From ef0a5caae2cf20b18e165da2dfa38180fed7da0b Mon Sep 17 00:00:00 2001 From: rosbeef andino Date: Thu, 20 Oct 2022 00:50:59 +0000 Subject: [PATCH 1/3] make rustc install/update thrue rustup --- scripts/install | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/install b/scripts/install index 24ed703..abd33ee 100755 --- a/scripts/install +++ b/scripts/install @@ -155,8 +155,17 @@ ynh_script_progression --message="Installing Mautrix-Bridge Python Module..." -- mkdir -p /var/log/$app # Configure Mautrix-Bridge +export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin" +if [ -e $final_path/.rustup ]; then + sudo -u "$app" env PATH=$PATH rustup update +else + sudo -u "$app" bash -c 'curl -sSf -L https://static.rust-lang.org/rustup.sh | sh -s -- -y --default-toolchain=stable --profile=minimal' +fi + python3 -m venv $final_path export HOME=$final_path + + $final_path/bin/pip3 install --upgrade pip setuptools wheel $final_path/bin/pip3 install --upgrade $final_path/src/mautrix-telegram.tar.gz[speedups,qr_login] # metrics,e2be,hq_thumbnails,sqlite,formattednumbers From afc17adbf9f694616c56a295776c2ab764a15c75 Mon Sep 17 00:00:00 2001 From: rosbeef andino Date: Thu, 20 Oct 2022 02:57:30 +0000 Subject: [PATCH 2/3] tale rustup rustc version --- scripts/upgrade | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index f7fdee6..ea73a46 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -129,6 +129,14 @@ chown $app:$app "$final_path/config.yaml" #================================================= ynh_script_progression --message="Upgrading Mautrix-Bridge Python Module..." --weight=2 +export PATH="$PATH:$final_path/.cargo/bin:$final_path/.local/bin:/usr/local/sbin" +if [ -e $final_path/.rustup ]; then + sudo -u "$app" env PATH=$PATH rustup update +else + sudo -u "$app" bash -c 'curl -sSf -L https://static.rust-lang.org/rustup.sh | sh -s -- -y --default-toolchain=stable --profile=minimal' +fi + + python3 -m venv $final_path export HOME=$final_path $final_path/bin/pip3 install --upgrade pip setuptools wheel From 3f5afb97746516ef87759daa39a5e7ec754f1f96 Mon Sep 17 00:00:00 2001 From: rosbeef andino Date: Sun, 8 Jan 2023 14:47:39 +0000 Subject: [PATCH 3/3] Update upgrade --- scripts/upgrade | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index ea73a46..956044c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -129,6 +129,8 @@ chown $app:$app "$final_path/config.yaml" #================================================= ynh_script_progression --message="Upgrading Mautrix-Bridge Python Module..." --weight=2 +# 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 "$app" env PATH=$PATH rustup update @@ -137,15 +139,30 @@ else fi -python3 -m venv $final_path +# Install virtualenv if it don't exist +test -e $final_path/bin/python3 || python3 -m venv $final_path export HOME=$final_path +# Install mautrix_telegram in virtualenv + +# We set all necessary environement variable to create a python virtualenvironnement. +u_arg='u' +set +$u_arg; +source $final_path/bin/activate +set -$u_arg; + $final_path/bin/pip3 install --upgrade pip setuptools wheel +chown $app:root -R $final_path $final_path/bin/pip3 install --upgrade $final_path/src/mautrix-telegram.tar.gz[speedups,qr_login] # metrics,e2be,hq_thumbnails,sqlite,formattednumbers if [ $encryption -eq 1 ]; then $final_path/bin/pip3 install --upgrade $final_path/src/mautrix-telegram.tar.gz[e2be] fi +# 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_arg; +deactivate +set -$u_arg; + #================================================= # REGISTER SYNAPSE APP-SERVICE #=================================================