From 2b9fd12b118fa1fa638ea60ba61ac1991552624b Mon Sep 17 00:00:00 2001 From: admin Date: Fri, 12 Oct 2018 00:09:18 +0200 Subject: [PATCH] Add compatibility with Yunohost 3.2 / Stretch: * Pip<10 * Nginx path configuration dynamic --- conf/nginx.conf | 2 +- scripts/_common.sh | 2 ++ scripts/install | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 0d9b249..a31ba1c 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,5 +1,5 @@ location PATHTOCHANGE/static/ { - alias /opt/yunohost/ihatemoney/venv/lib/python3.4/site-packages/ihatemoney/static/; + alias APPHOME/static/; } location PATHTOCHANGE { # Force https. diff --git a/scripts/_common.sh b/scripts/_common.sh index bd53ef1..bad1049 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -41,8 +41,10 @@ init_virtualenv () { configure_nginx () { local domain=$1 local path=$2 + local app_home=$3 sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf + sed -i "s@APPHOME@$app_home@g" ../conf/nginx.conf # Fix double-slash for domain-root install sed -i "s@location //@location /@" ../conf/nginx.conf sudo install -o root -g root -m644 \ diff --git a/scripts/install b/scripts/install index a30b6e1..5513050 100755 --- a/scripts/install +++ b/scripts/install @@ -62,11 +62,13 @@ create_unix_user # Prepare venv init_virtualenv +sudo /opt/yunohost/ihatemoney/venv/bin/pip install 'pip<10' sudo /opt/yunohost/ihatemoney/venv/bin/pip install \ 'gunicorn>=19.3.0' \ 'PyMySQL>=0.9,<0.10' \ 'ihatemoney>=2,<3' \ +app_home=$(dirname $(find /opt/yunohost/ihatemoney/venv/lib/ -type d -name static | head -n1)) create_system_dirs # Configure gunicorn @@ -97,7 +99,7 @@ then fi # Configure Nginx -configure_nginx "$domain" "$path" +configure_nginx "$domain" "$path" "$app_home" # Start backend sudo systemctl start supervisor