1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/rainloop_ynh.git synced 2024-09-03 20:16:18 +02:00

Apply last example_ynh

This commit is contained in:
yalh76 2019-03-01 15:01:28 +01:00
parent daad1682c8
commit d1559677f5
7 changed files with 41 additions and 40 deletions

View file

@ -1,7 +1,7 @@
#!/bin/bash
#=================================================
# PERSONNAL HELPERS
# PERSONAL HELPERS
#=================================================
#=================================================
@ -9,5 +9,5 @@
#=================================================
#=================================================
# FUTUR OFFICIAL HELPERS
# FUTURE OFFICIAL HELPERS
#=================================================

View file

@ -19,7 +19,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info "Load settings"
ynh_print_info "Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@ -32,28 +32,28 @@ db_name=$(ynh_app_setting_get $app db_name)
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_print_info "Backup the app main dir"
ynh_print_info "Backing up the main app directory..."
ynh_backup "$final_path"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_print_info "Backup nginx configuration"
ynh_print_info "Backing up nginx web server configuration..."
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP THE PHP-FPM CONFIGURATION
#=================================================
ynh_print_info "Backup php-fpm configuration"
ynh_print_info "Backing up php-fpm configuration..."
ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf"
#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================
ynh_print_info "Backup the mysql database"
ynh_print_info "Backing up the MySQL database..."
ynh_mysql_dump_db "$db_name" > db.sql
@ -61,4 +61,4 @@ ynh_mysql_dump_db "$db_name" > db.sql
# END OF SCRIPT
#=================================================
ynh_print_info "Backup script completed. Please wait for YunoHost to create the backup."
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -25,7 +25,7 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info "Load settings"
ynh_print_info "Loading installation settings..."
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get $app final_path)
@ -61,7 +61,7 @@ fi
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_print_info "Modify url in nginx configuration"
ynh_print_info "Updating nginx web server configuration..."
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
@ -116,7 +116,7 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info "Reload nginx"
ynh_print_info "Reloading nginx web server..."
systemctl reload nginx
@ -124,4 +124,4 @@ systemctl reload nginx
# END OF SCRIPT
#=================================================
ynh_print_info "Change of url completed"
ynh_print_info "Change of URL completed for $app"

View file

@ -33,7 +33,7 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_print_info "Validating arguments ..."
ynh_print_info "Validating installation parameters..."
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die "This path already contains a folder"
@ -47,7 +47,7 @@ ynh_webpath_register $app $domain $path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_print_info "Store settings from manifest ..."
ynh_print_info "Storing installation settings..."
ynh_app_setting_set $app domain $domain
ynh_app_setting_set $app path $path_url
@ -79,7 +79,7 @@ ynh_setup_source "$final_path/app"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_print_info "Configuring nginx ..."
ynh_print_info "Configuring nginx web server..."
# Create a dedicated nginx config
ynh_add_nginx_config
@ -190,7 +190,7 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info "Reloading nginx ..."
ynh_print_info "Reloading nginx web server..."
systemctl reload nginx
@ -198,4 +198,4 @@ systemctl reload nginx
# END OF SCRIPT
#=================================================
ynh_print_info "Installation completed"
ynh_print_info "Installation of $app completed"

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info "Load settings"
ynh_print_info "Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@ -25,7 +25,7 @@ final_path=$(ynh_app_setting_get $app final_path)
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
ynh_print_info "Remove the mysql database"
ynh_print_info "Removing the MySQL database"
# Remove a database if it exists, along with the associated user
ynh_mysql_remove_db $db_name $db_name
@ -33,7 +33,7 @@ ynh_mysql_remove_db $db_name $db_name
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_print_info "Remove app main directory"
ynh_print_info "Removing app main directory"
# Remove the app directory securely
ynh_secure_remove "$final_path"
@ -41,7 +41,7 @@ ynh_secure_remove "$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_print_info "Remove nginx configuration"
ynh_print_info "Removing nginx web server configuration"
# Remove the dedicated nginx config
ynh_remove_nginx_config
@ -49,7 +49,7 @@ ynh_remove_nginx_config
#=================================================
# REMOVE PHP-FPM CONFIGURATION
#=================================================
ynh_print_info "Remove php-fpm configuration"
ynh_print_info "Removing php-fpm configuration"
# Remove the dedicated php-fpm config
ynh_remove_fpm_config
@ -67,7 +67,7 @@ gpg --batch --delete-key --yes Rainloop
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_print_info "Remove the dedicated user"
ynh_print_info "Removing the dedicated system user"
# Delete a system user
ynh_system_user_delete $app
@ -76,4 +76,4 @@ ynh_system_user_delete $app
# END OF SCRIPT
#=================================================
ynh_print_info "Deletion completed"
ynh_print_info "Removal of $app completed"

View file

@ -19,7 +19,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info "Load settings"
ynh_print_info "Loading settings..."
app=$YNH_APP_INSTANCE_NAME
@ -31,6 +31,7 @@ db_name=$(ynh_app_setting_get $app db_name)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_print_info "Validating restoration parameters..."
ynh_webpath_available $domain $path_url \
|| ynh_die "Path not available: ${domain}${path_url}"
@ -48,14 +49,14 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_print_info "Restore the app main directory"
ynh_print_info "Restoring the app main directory..."
ynh_restore_file "$final_path"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_print_info "Recreate the dedicated user"
ynh_print_info "Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
ynh_system_user_create $app
@ -76,7 +77,7 @@ ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf"
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
ynh_print_info "Restore the mysql database"
ynh_print_info "Restoring the MySQL database..."
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
ynh_mysql_setup_db $db_name $db_name $db_pwd
@ -87,7 +88,7 @@ ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_print_info "Reload nginx and php-fpm"
ynh_print_info "Reloading nginx web server and php-fpm..."
systemctl reload php7.0-fpm
systemctl reload nginx
@ -96,4 +97,4 @@ systemctl reload nginx
# END OF SCRIPT
#=================================================
ynh_print_info "Restoration completed"
ynh_print_info "Restoration completed for $app"

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info "Load settings"
ynh_print_info "Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@ -26,7 +26,7 @@ db_name=$(ynh_app_setting_get $app db_name)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_print_info "Ensure downward compatibility"
ynh_print_info "Ensuring downward compatibility..."
# Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then
@ -52,7 +52,7 @@ fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_print_info "Backup the app before upgrading"
ynh_print_info "Backing up the app before upgrading (may take a while)..."
# Backup the current version of the app
ynh_backup_before_upgrade
@ -75,7 +75,7 @@ path_url=$(ynh_normalize_url_path $path_url)
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_print_info "Download, check and unpack source"
ynh_print_info "Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path/app"
@ -83,7 +83,7 @@ ynh_setup_source "$final_path/app"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_print_info "Reconfigure nginx"
ynh_print_info "Upgrading nginx web server configuration..."
# Create a dedicated nginx config
ynh_add_nginx_config
@ -91,7 +91,7 @@ ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_print_info "Create a dedicated user"
ynh_print_info "Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create $app
@ -99,7 +99,7 @@ ynh_system_user_create $app
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_print_info "Reconfigure php-fpm"
ynh_print_info "Upgrading php-fpm configuration..."
# Create a dedicated php-fpm config
ynh_add_fpm_config
@ -138,7 +138,7 @@ find $final_path/. -type f -exec chmod 644 {} \;
#=================================================
# SETUP SSOWAT
#=================================================
ynh_print_info "Reconfigure SSOwat"
ynh_print_info "Upgrading SSOwat configuration..."
# Make app public if necessary
if [ $is_public -eq 1 ]
@ -150,7 +150,7 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info "Reload nginx"
ynh_print_info "Reloading nginx web server..."
systemctl reload nginx
@ -158,4 +158,4 @@ systemctl reload nginx
# END OF SCRIPT
#=================================================
ynh_print_info "Upgrade completed"
ynh_print_info "Upgrade of $app completed"