diff --git a/scripts/backup b/scripts/backup index 17446d9..b1eb5ac 100644 --- a/scripts/backup +++ b/scripts/backup @@ -21,9 +21,11 @@ ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME +final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) admin=$(ynh_app_setting_get --app=$app --key=admin) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -36,8 +38,11 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$final_path" -books_path=/home/$admin/calibre_library -ynh_backup "$books_path" "data" +#================================================= +# BACKUP THE DATA DIR +#================================================= + +ynh_backup --src_path="$datadir" --is_big #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/remove b/scripts/remove index ed7d445..81c1653 100644 --- a/scripts/remove +++ b/scripts/remove @@ -16,9 +16,10 @@ ynh_script_progression --message="Loading installation settings..." --weight=3 app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get "$app" domain) -admin=$(ynh_app_setting_get "$app" admin) -books_path=/home/$admin/calibre_library +domain=$(ynh_app_setting_get --app=$app --key=domain) +admin=$(ynh_app_setting_get --app=$app --key=admin) +datadir=$(ynh_app_setting_get --app=$app --key=datadir) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # REMOVE APP MAIN DIR @@ -34,7 +35,7 @@ ynh_secure_remove --file="$final_path" ynh_script_progression --message="Removing app main directory..." --weight=4 # Remove the app directory securely -ynh_secure_remove --file="$books_path" +ynh_secure_remove --file="$datadir" #================================================= # REMOVE NGINX CONFIGURATION diff --git a/scripts/restore b/scripts/restore index e7d488f..23ba668 100644 --- a/scripts/restore +++ b/scripts/restore @@ -27,6 +27,8 @@ domain=$(ynh_app_setting_get "$app" domain) path_url=$(ynh_app_setting_get --app=$app --key=path) admin=$(ynh_app_setting_get "$app" admin) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +datadir=$(ynh_app_setting_get --app=$app --key=datadir) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -71,7 +73,7 @@ chown -R $app:www-data "$final_path" # you may need to make some file and/or directory writeable by www-data (nginx user) chown -R root: "$final_path" -chown -R $admin "$books_path" +chown -R $admin "$datadir" #================================================= # RESTORE THE PHP-FPM CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 538b3c1..e018598 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -17,11 +17,11 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get "$app" domain) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) path_url=$(ynh_app_setting_get --app=$app --key=path) admin=$(ynh_app_setting_get "$app" admin) -is_public=$(ynh_app_setting_get "$app" is_public) -language=$(ynh_app_setting_get "$app" language) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # CHECK VERSION @@ -54,12 +54,6 @@ if [ -z "$final_path" ]; then ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi -# If db_name doesn't exist, create it -if [ -z "$db_name" ]; then - db_name=$(ynh_sanitize_dbid --db_name=$app) - ynh_app_setting_set --app=$app --key=db_name --value=$db_name -fi - # Cleaning legacy permissions if ynh_legacy_permissions_exists; then ynh_legacy_permissions_delete_all @@ -85,9 +79,6 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=7 - # Create a temporary directory - #tmpdir="$(ynh_smart_mktemp --min_size=10)" - # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" fi