1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/weblate_ynh.git synced 2024-10-01 13:35:04 +02:00

Remove install from source and copy settings at the right place

This commit is contained in:
Jean-Baptiste Holcroft 2017-09-15 16:59:22 +02:00
parent 7603dd6c38
commit f3590b0d7c
3 changed files with 22 additions and 34 deletions

View file

@ -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

View file

@ -59,7 +59,7 @@ DATABASES = {
} }
} }
BASE_DIR = os.path.dirname(os.path.abspath(__file__)) BASE_DIR = '__FINALPATH__'
# Data directory # Data directory
DATA_DIR = os.path.join(BASE_DIR, '..', 'data') DATA_DIR = os.path.join(BASE_DIR, '..', 'data')

View file

@ -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 # 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;" 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 # NGINX CONFIGURATION
#================================================= #=================================================
@ -134,25 +126,6 @@ systemctl restart $app.uwsgi.service
# Add weblate.uwsgi as a service # Add weblate.uwsgi as a service
yunohost service add $app.uwsgi.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 # PIP INSTALLATION
#================================================= #=================================================
@ -165,6 +138,27 @@ virtualenv ${final_path}/venv
${final_path}/venv/bin/pip install pytz python-bidi PyYaML Babel pyuca pylibravatar pydns ${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 # SPECIFIC SETUP Filling up the database
# https://docs.weblate.org/en/latest/admin/install.html#filling-up-the-database # https://docs.weblate.org/en/latest/admin/install.html#filling-up-the-database