Fix upgrade from previous versions

pull/6/head
Jean-Baptiste Holcroft 7 years ago
parent 21cf715388
commit 333e0973e6

@ -4,16 +4,16 @@
domain="domain.tld" (DOMAIN) domain="domain.tld" (DOMAIN)
path="/path" (PATH) path="/path" (PATH)
; Checks ; Checks
pkg_linter=1 pkg_linter=0
setup_sub_dir=1 setup_sub_dir=0
setup_root=1 setup_root=0
setup_nourl=0 setup_nourl=0
setup_private=1 setup_private=0
setup_public=0 setup_public=0
upgrade=1 upgrade=0
; test upgrade from latest published version # test upgrade from latest published version
upgrade=1 from_commit=fd6350495d5a1d864ae30e1a61e18939fdb6a428 upgrade=1 from_commit=fd6350495d5a1d864ae30e1a61e18939fdb6a428
; test upgrade from latest git commit before Jibec's rewriting # test upgrade from latest git commit before Jibec's rewriting
upgrade=1 from_commit=267ccc21f7b52d22bc3d5b9cd6239857b9a82aad upgrade=1 from_commit=267ccc21f7b52d22bc3d5b9cd6239857b9a82aad
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1

@ -70,10 +70,8 @@ ynh_install_app_dependencies make python-dev python-virtualenv \
# Use 'FSyncMS' as database name and user # Use 'FSyncMS' as database name and user
db_user=$app db_user=$app
db_name=$(ynh_sanitize_dbid $app) db_name=$(ynh_sanitize_dbid $app)
db_pwd=$(ynh_string_random)
ynh_app_setting_set "$app" db_name "$db_name" ynh_app_setting_set "$app" db_name "$db_name"
ynh_app_setting_set "$app" db_pwd "$db_name"
ynh_mysql_setup_db "$db_user" "$db_name" ynh_mysql_setup_db "$db_user" "$db_name"
#================================================= #=================================================
@ -182,6 +180,7 @@ yunohost service add "$app" -l /var/log/$app/$app.log
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
# accessible by everyone (authentification is done by firefox accounts)
ynh_app_setting_set "$app" skipped_uris "/" ynh_app_setting_set "$app" skipped_uris "/"
#================================================= #=================================================

@ -59,7 +59,7 @@ ynh_restore_file "$final_path"
# RESTORE THE MYSQL DATABASE # RESTORE THE MYSQL DATABASE
#================================================= #=================================================
db_pwd=$(ynh_app_setting_get "$app" db_pwd) db_pwd=$(ynh_app_setting_get "$app" mysqlpwd)
ynh_mysql_setup_db "$db_name" "$db_name" "$db_pwd" ynh_mysql_setup_db "$db_name" "$db_name" "$db_pwd"
ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" < ./db.sql ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" < ./db.sql

@ -26,7 +26,7 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get "$app" domain) domain=$(ynh_app_setting_get "$app" domain)
path_url=$(ynh_app_setting_get "$app" path_url) path_url=$(ynh_app_setting_get "$app" path_url)
db_name=$(ynh_app_setting_get "$app" db_name) db_name=$(ynh_app_setting_get "$app" db_name)
db_pwd=$(ynh_app_setting_get "$app" db_pwd) db_pwd=$(ynh_app_setting_get "$app" mysqlpwd)
db_user=$app db_user=$app
final_path=$(ynh_app_setting_get "$app" final_path) final_path=$(ynh_app_setting_get "$app" final_path)
secret=$(ynh_app_setting_get "$app" secret) secret=$(ynh_app_setting_get "$app" secret)
@ -47,6 +47,18 @@ if [ -z "$final_path" ]; then
ynh_app_setting_set "$app" final_path "$final_path" ynh_app_setting_set "$app" final_path "$final_path"
fi fi
# Detect old installation style
if [ -e /opt/yunohost/ffsync ]; then
service ffsync stop
update-rc.d -f ffsync remove
ynh_secure_remove /etc/init.d/ffsync
ynh_secure_remove /var/log/ffsync.log
ynh_secure_remove /opt/yunohost/ffsync
ynh_add_systemd_config
fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
@ -157,5 +169,6 @@ ynh_app_setting_set "$app" skipped_uris "/"
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
systemctl stop "$app.service"
systemctl start "$app.service" systemctl start "$app.service"
systemctl reload nginx systemctl reload nginx

Loading…
Cancel
Save