2021-01-07 22:22:46 +01:00
|
|
|
dependances="coturn build-essential python3-dev libffi-dev python3-pip python3-setuptools sqlite3 libssl-dev python3-venv libxml2-dev libxslt1-dev python3-lxml zlib1g-dev libjpeg-dev libpq-dev postgresql acl"
|
2020-07-29 22:52:58 +02:00
|
|
|
python_version="$(python3 -V | cut -d' ' -f2 | cut -d. -f1-2)"
|
2022-05-26 16:41:22 +02:00
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
2020-07-29 22:52:58 +02:00
|
|
|
|
|
|
|
install_sources() {
|
|
|
|
# Install/upgrade synapse in virtualenv
|
|
|
|
|
|
|
|
# Clean venv is it was on python2.7 or python3 with old version in case major upgrade of debian
|
|
|
|
if [ ! -e $final_path/bin/python3 ] || [ ! -e $final_path/lib/python$python_version ]; then
|
2021-03-19 16:48:35 +01:00
|
|
|
ynh_secure_remove --file=$final_path/bin
|
|
|
|
ynh_secure_remove --file=$final_path/lib
|
|
|
|
ynh_secure_remove --file=$final_path/lib64
|
|
|
|
ynh_secure_remove --file=$final_path/include
|
|
|
|
ynh_secure_remove --file=$final_path/share
|
|
|
|
ynh_secure_remove --file=$final_path/pyvenv.cfg
|
2020-07-29 22:52:58 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p $final_path
|
2021-02-13 12:01:26 +01:00
|
|
|
chown $synapse_user:root -R $final_path
|
2020-07-29 22:52:58 +02:00
|
|
|
|
|
|
|
if [ -n "$(uname -m | grep arm)" ]
|
|
|
|
then
|
|
|
|
# Clean old file, sometimes it could make some big issues if we don't do this!!
|
|
|
|
ynh_secure_remove --file=$final_path/bin
|
|
|
|
ynh_secure_remove --file=$final_path/lib
|
|
|
|
ynh_secure_remove --file=$final_path/include
|
|
|
|
ynh_secure_remove --file=$final_path/share
|
|
|
|
|
|
|
|
ynh_setup_source --dest_dir=$final_path/ --source_id="armv7_$(lsb_release --codename --short)"
|
|
|
|
|
|
|
|
# Fix multi-instance support
|
|
|
|
for f in $(ls $final_path/bin); do
|
|
|
|
if ! [[ $f =~ "__" ]]; then
|
|
|
|
ynh_replace_special_string --match_string='#!/opt/yunohost/matrix-synapse' --replace_string='#!'$final_path --target_file=$final_path/bin/$f
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
else
|
2021-04-05 12:55:40 +02:00
|
|
|
|
2020-07-29 22:52:58 +02:00
|
|
|
# Install virtualenv if it don't exist
|
|
|
|
test -e $final_path/bin/python3 || python3 -m venv $final_path
|
|
|
|
|
|
|
|
# Install synapse in virtualenv
|
|
|
|
|
|
|
|
# We set all necessary environement variable to create a python virtualenvironnement.
|
2021-04-01 22:01:33 +02:00
|
|
|
u_arg='u'
|
2021-10-27 19:23:02 +02:00
|
|
|
set +$u_arg;
|
2020-07-29 22:52:58 +02:00
|
|
|
source $final_path/bin/activate
|
2021-10-27 19:23:02 +02:00
|
|
|
set -$u_arg;
|
2022-05-28 14:16:59 +02:00
|
|
|
if [ $(lsb_release --codename --short) == "bullseye" ]; then
|
2023-02-09 19:44:59 +01:00
|
|
|
# Fix issue with setuptools https://github.com/pypa/setuptools/issues/3118
|
2022-05-28 14:16:59 +02:00
|
|
|
pip3 install --upgrade setuptools==60.8.2 wheel pip
|
|
|
|
else
|
|
|
|
pip3 install --upgrade setuptools wheel pip
|
|
|
|
fi
|
2022-09-10 15:39:56 +02:00
|
|
|
|
2020-07-29 22:52:58 +02:00
|
|
|
pip3 install --upgrade cffi ndg-httpsclient psycopg2 lxml jinja2
|
2023-03-06 08:34:48 +01:00
|
|
|
pip3 install --upgrade -r $YNH_APP_BASEDIR/conf/requirement_$(lsb_release --codename --short).txt
|
2020-07-29 22:52:58 +02:00
|
|
|
|
|
|
|
# This function was defined when we called "source $final_path/bin/activate". With this function we undo what "$final_path/bin/activate" does
|
2021-10-27 19:23:02 +02:00
|
|
|
set +$u_arg;
|
2020-07-29 22:52:58 +02:00
|
|
|
deactivate
|
2021-10-27 19:23:02 +02:00
|
|
|
set -$u_arg;
|
2020-07-29 22:52:58 +02:00
|
|
|
fi
|
|
|
|
}
|
2022-05-28 00:17:09 +02:00
|
|
|
|
|
|
|
get_domain_list() {
|
|
|
|
yunohost --output-as plain domain list | grep -E "^#" -v | sort | uniq | while read domain; do
|
2022-09-10 15:39:56 +02:00
|
|
|
echo -n " - https://$domain\n"
|
2022-05-28 00:17:09 +02:00
|
|
|
done
|
|
|
|
}
|