From 5adeb77268511789dc1e141e27d5fc8a4a078304 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Fri, 15 Sep 2017 16:59:22 +0200 Subject: [PATCH] Remove install from source and copy settings at the right place --- conf/app.src | 6 ------ conf/settings.py | 2 +- scripts/install | 48 +++++++++++++++++++++--------------------------- 3 files changed, 22 insertions(+), 34 deletions(-) delete mode 100644 conf/app.src diff --git a/conf/app.src b/conf/app.src deleted file mode 100644 index 729f27c..0000000 --- a/conf/app.src +++ /dev/null @@ -1,6 +0,0 @@ -SOURCE_URL=https://dl.cihar.com/weblate/Weblate-2.16.tar.xz -SOURCE_SUM=0cd67d3eef8fb414c55d9447a361feb9718e39460c85de51fc0c636838625c70 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=tar.xz -SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=Weblate-2.16.tar.xz diff --git a/conf/settings.py b/conf/settings.py index d53c5c4..8df879a 100644 --- a/conf/settings.py +++ b/conf/settings.py @@ -59,7 +59,7 @@ DATABASES = { } } -BASE_DIR = os.path.dirname(os.path.abspath(__file__)) +BASE_DIR = '__FINALPATH__' # Data directory DATA_DIR = os.path.join(BASE_DIR, '..', 'data') diff --git a/scripts/install b/scripts/install index 06061ec..f5442dc 100755 --- a/scripts/install +++ b/scripts/install @@ -85,14 +85,6 @@ ynh_mysql_setup_db $db_name $db_name # https://docs.weblate.org/en/latest/admin/install.html#unicode-issues-in-mysql ynh_mysql_execute_as_root "ALTER DATABASE $db_name CHARACTER SET utf8mb4;" -#================================================= -# DOWNLOAD, CHECK AND UNPACK SOURCE -#================================================= - -ynh_app_setting_set $app final_path $final_path -# Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source "$final_path" - #================================================= # NGINX CONFIGURATION #================================================= @@ -134,25 +126,6 @@ systemctl restart $app.uwsgi.service # Add weblate.uwsgi as a service yunohost service add $app.uwsgi.service -#================================================= -# SPECIFIC SETUP settings.py -# https://docs.weblate.org/en/latest/admin/install.html#installation -#================================================= -echo "SPECIFIC SETUP settings.py" -db_pwd=$(ynh_app_setting_get $app mysqlpwd) -admin_mail="$(ynh_user_get_info $admin mail)" -key=$(ynh_string_random 64) - -cp ../conf/settings.py $final_path/weblate/settings.py - -ynh_replace_string "__NAME__" "$app" $final_path/weblate/settings.py -ynh_replace_string "__DB_PWD__" "$db_pwd" $final_path/weblate/settings.py -ynh_replace_string "__ADMIN__" "$admin" $final_path/weblate/settings.py -ynh_replace_string "__ADMINMAIL__" "$admin_mail" $final_path/weblate/settings.py -ynh_replace_string "__DOMAIN__" "$domain" $final_path/weblate/settings.py -ynh_replace_string "__KEY__" "$key" $final_path/weblate/settings.py -ynh_replace_string "__PATHURL__" "$path_url" $final_path/weblate/settings.py - #================================================= # PIP INSTALLATION #================================================= @@ -165,6 +138,27 @@ virtualenv ${final_path}/venv ${final_path}/venv/bin/pip install pytz python-bidi PyYaML Babel pyuca pylibravatar pydns ) +#================================================= +# SPECIFIC SETUP settings.py +# https://docs.weblate.org/en/latest/admin/install.html#installation +#================================================= +echo "SPECIFIC SETUP settings.py" +db_pwd=$(ynh_app_setting_get $app mysqlpwd) +admin_mail="$(ynh_user_get_info $admin mail)" +key=$(ynh_string_random 64) + +cp ../conf/settings.py $final_path/venv/lib/python2.7/site-packages/weblate/settings.py + +ynh_replace_string "__NAME__" "$app" $final_path/venv/lib/python2.7/site-packages/weblate/settings.py +ynh_replace_string "__DB_PWD__" "$db_pwd" $final_path/venv/lib/python2.7/site-packages/weblate/settings.py +ynh_replace_string "__ADMIN__" "$admin" $final_path/venv/lib/python2.7/site-packages/weblate/settings.py +ynh_replace_string "__ADMINMAIL__" "$admin_mail" $final_path/venv/lib/python2.7/site-packages/weblate/settings.py +ynh_replace_string "__DOMAIN__" "$domain" $final_path/venv/lib/python2.7/site-packages/weblate/settings.py +ynh_replace_string "__KEY__" "$key" $final_path/venv/lib/python2.7/site-packages/weblate/settings.py +ynh_replace_string "__PATHURL__" "$path_url" $final_path/venv/lib/python2.7/site-packages/weblate/settings.py +ynh_replace_string "__FINALPATH__" "$final_path" $final_path/venv/lib/python2.7/site-packages/weblate/settings.py + + #================================================= # SPECIFIC SETUP Filling up the database # https://docs.weblate.org/en/latest/admin/install.html#filling-up-the-database