diff --git a/scripts/backup b/scripts/backup index 8e94cd5..52d6e9c 100644 --- a/scripts/backup +++ b/scripts/backup @@ -22,7 +22,7 @@ source /usr/share/yunohost/helpers app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get $app domain) -final_path="/var/www/${app}" +final_path=$(ynh_app_setting_get $app final_path) db_name=$(ynh_app_setting_get $app db_name) #================================================= @@ -32,24 +32,24 @@ db_name=$(ynh_app_setting_get $app db_name) #================================================= CHECK_SIZE "$final_path" -ynh_backup "$final_path" "sources" +ynh_backup "$final_path" #================================================= # BACKUP NGINX CONFIGURATION #================================================= -ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "nginx.conf" +ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP PHP-FPM CONFIGURATION #================================================= -ynh_backup "/etc/php5/fpm/pool.d/$app.conf" "php-fpm.conf" +ynh_backup "/etc/php5/fpm/pool.d/$app.conf" +ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini" #================================================= # BACKUP MYSQL DB #================================================= -ynh_mysql_dump_db "$db_name" > dump.sql -CHECK_SIZE "dump.sql" -ynh_backup "dump.sql" "db.sql" \ No newline at end of file +ynh_mysql_dump_db "$db_name" > db.sql +CHECK_SIZE "db.sql" diff --git a/scripts/restore b/scripts/restore index 8058237..526e58d 100644 --- a/scripts/restore +++ b/scripts/restore @@ -31,8 +31,10 @@ db_name=$(ynh_app_setting_get $app db_name) # CHECK IF THE APP CAN BE RESTORED #================================================= -CHECK_DOMAINPATH # Check domain and path availability -CHECK_FINALPATH # Check if destination directory is not already in use +yunohost app checkurl "${domain}${path_url}" -a "$app" \ + || ynh_die "Path not available: ${domain}${path_url}" +test ! -d $final_path \ + || ynh_die "There is already a directory: $final_path " #================================================= # INSTALL DEPENDENCIES @@ -46,13 +48,13 @@ ynh_install_app_dependencies "$PKG_DEPENDENCIES" # RESTORE NGINX CONFIGURATION #================================================= -cp -a ./nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf +ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE APP MAIN DIR #================================================= -cp -a ./sources/. $final_path +ynh_restore_file "$final_path" #================================================= # RESTORE MYSQL DB @@ -78,7 +80,8 @@ chown -R $app: $final_path # RESTORE PHP-FPM CONFIGURATION #================================================= -cp -a ./php-fpm.conf /etc/php5/fpm/pool.d/$app.conf +ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf" +ynh_restore_file "/etc/php5/fpm/conf.d/20-$app.ini" #================================================= # GENERIC FINALIZATION