diff --git a/scripts/upgrade b/scripts/upgrade index 9ac8429..babca94 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -38,11 +38,21 @@ if [ -z "${default_from_email:-}" ]; then ynh_app_setting_set --app="$app" --key=default_from_email --value="$default_from_email" fi +if [ -d "/opt/yunohost/$app" ]; then + if [ -d "$install_dir/app" ]; then + ynh_secure_remove --file="/opt/yunohost/$app" + else + mv "/opt/yunohost/$app" "$install_dir/app" + fi +fi + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Upgrading source files..." --weight=1 +mkdir -p "$install_dir/"{app,public/media,public/static} + ynh_add_config --template="requirements.txt" --destination="$install_dir/app/requirements.txt" ynh_add_config --template="gunicorn.conf.py" --destination="$install_dir/app/gunicorn.conf.py" @@ -57,6 +67,12 @@ ynh_add_config --template="wsgi.py" --destination="$install_dir/app/wsgi.py" chown -R "$app:www-data" "$install_dir" +chown -R "$app:www-data" "$install_dir" + +mkdir -p "/var/log/$app" +touch "/var/log/$app/$app.log" +chown -R "$app:$app" "/var/log/$app" + #================================================= # PYTHON VIRTUALENV #================================================= diff --git a/tests.toml b/tests.toml index 953b195..1ecf662 100644 --- a/tests.toml +++ b/tests.toml @@ -7,3 +7,5 @@ test_format = 1.0 # ------------ # Tests to run # ------------ + + test_upgrade_from.4b0799f31dfbde3884f88aed8ebb5a42c4dc4a69.name = "Packaging v1"