Handle packagingv1 -> v2 migration

This commit is contained in:
Salamandar 2024-03-29 00:34:55 +01:00
parent 3da2221a73
commit 9c99d078f7
2 changed files with 18 additions and 0 deletions

View file

@ -38,11 +38,21 @@ if [ -z "${default_from_email:-}" ]; then
ynh_app_setting_set --app="$app" --key=default_from_email --value="$default_from_email" ynh_app_setting_set --app="$app" --key=default_from_email --value="$default_from_email"
fi 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 # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Upgrading source files..." --weight=1 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="requirements.txt" --destination="$install_dir/app/requirements.txt"
ynh_add_config --template="gunicorn.conf.py" --destination="$install_dir/app/gunicorn.conf.py" 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"
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 # PYTHON VIRTUALENV
#================================================= #=================================================

View file

@ -7,3 +7,5 @@ test_format = 1.0
# ------------ # ------------
# Tests to run # Tests to run
# ------------ # ------------
test_upgrade_from.4b0799f31dfbde3884f88aed8ebb5a42c4dc4a69.name = "Packaging v1"