mirror of
https://github.com/YunoHost-Apps/agendav_ynh.git
synced 2024-09-03 20:36:12 +02:00
Add progression with ynh_print_info
This commit is contained in:
parent
83cdb1dfc7
commit
92292c46fe
7 changed files with 80 additions and 10 deletions
|
@ -1,6 +1,6 @@
|
|||
# AgenDAV for YunoHost
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/agendav)
|
||||
[](https://dash.yunohost.org/appci/app/agendav)
|
||||
[](https://install-app.yunohost.org/?app=agendav)
|
||||
|
||||
> *This package allow you to install AgenDAV quickly and simply on a YunoHost server.
|
||||
|
@ -55,7 +55,6 @@ AJAX interface to allow users to manage their own calendars and shared ones.
|
|||
Developers info
|
||||
----------------
|
||||
|
||||
**Only if you want to use a testing branch for coding, instead of merging directly into master.**
|
||||
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/agendav_ynh/tree/testing).
|
||||
|
||||
To try the testing branch, please proceed like that.
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
},
|
||||
"url": "http://agendav.org/",
|
||||
"license": "GPL-3.0",
|
||||
"version": "2.0.0",
|
||||
"version": "2.0.0~ynh1",
|
||||
"maintainer": {
|
||||
"name": "julien",
|
||||
"email": "julien.malik@paraiso.me"
|
||||
|
|
|
@ -20,6 +20,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info "Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -32,6 +33,7 @@ db_name=$(ynh_app_setting_get $app db_name)
|
|||
#=================================================
|
||||
# BACKUP THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_print_info "Backing up the main app directory..."
|
||||
|
||||
# Clean cache files before backup
|
||||
ynh_secure_remove ${final_path}/web/var/cache/{profiler,twig}/*
|
||||
|
@ -41,18 +43,21 @@ ynh_backup "$final_path"
|
|||
#=================================================
|
||||
# BACKUP THE 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 "Backing up php-fpm configuration..."
|
||||
|
||||
ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_print_info "Backing up the MySQL database..."
|
||||
|
||||
ynh_mysql_dump_db "$db_name" > db.sql
|
||||
|
||||
|
@ -61,5 +66,12 @@ ynh_mysql_dump_db "$db_name" > db.sql
|
|||
#=================================================
|
||||
# BACKUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_print_info "Backing up logrotate configuration..."
|
||||
|
||||
ynh_backup "/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||
|
|
|
@ -29,6 +29,7 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
ynh_print_info "Validating installation parameters..."
|
||||
|
||||
final_path=/var/www/$app
|
||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||
|
@ -62,6 +63,7 @@ fi
|
|||
#=================================================
|
||||
# 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
|
||||
|
@ -72,6 +74,7 @@ ynh_app_setting_set $app language $language
|
|||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_print_info "Installing dependencies..."
|
||||
|
||||
# Install dependencies
|
||||
ynh_install_app_dependencies php-cli
|
||||
|
@ -79,6 +82,7 @@ ynh_install_app_dependencies php-cli
|
|||
#=================================================
|
||||
# CREATE A MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_print_info "Creating a MySQL database..."
|
||||
|
||||
db_name=$(ynh_sanitize_dbid $app)
|
||||
ynh_app_setting_set $app db_name $db_name
|
||||
|
@ -87,6 +91,7 @@ ynh_mysql_setup_db $db_name $db_name
|
|||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_print_info "Setting up source files..."
|
||||
|
||||
ynh_app_setting_set $app final_path $final_path
|
||||
ynh_setup_source "$final_path"
|
||||
|
@ -94,6 +99,7 @@ ynh_setup_source "$final_path"
|
|||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info "Configuring nginx web server..."
|
||||
|
||||
# Copy and set nginx configuration
|
||||
ynh_add_nginx_config
|
||||
|
@ -101,12 +107,14 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_print_info "Configuring system user..."
|
||||
|
||||
ynh_system_user_create $app
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#================================================
|
||||
ynh_print_info "Configuring php-fpm..."
|
||||
|
||||
# Copy and set php-fpm configuration
|
||||
ynh_add_fpm_config
|
||||
|
@ -116,6 +124,7 @@ ynh_add_fpm_config
|
|||
#=================================================
|
||||
# CREATE SETTINGS.PHP
|
||||
#=================================================
|
||||
ynh_print_info "Configuring agendav..."
|
||||
|
||||
# Generate random encryption key
|
||||
encryptkey=$(ynh_string_random 24)
|
||||
|
@ -153,6 +162,7 @@ ynh_store_file_checksum "$conf_path"
|
|||
#=================================================
|
||||
# RUN DATABASE MIGRATIONS (INCLUDES INITIALIZATION)
|
||||
#=================================================
|
||||
ynh_print_info "Initialising agendav..."
|
||||
|
||||
(
|
||||
cd $final_path
|
||||
|
@ -162,6 +172,7 @@ ynh_store_file_checksum "$conf_path"
|
|||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_print_info "Configuring log rotation..."
|
||||
|
||||
mkdir -p $logdir
|
||||
chown -R $app: $logdir
|
||||
|
@ -186,9 +197,14 @@ chown -R root:$app ${final_path}/web/config/
|
|||
chmod -R 750 ${final_path}/web/config/
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX and FPM
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_print_info "Reloading nginx web server..."
|
||||
|
||||
systemctl reload nginx
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
# Reload services
|
||||
systemctl reload php5-fpm
|
||||
systemctl reload nginx
|
||||
ynh_print_info "Installation of $app completed"
|
||||
|
|
|
@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info "Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -24,6 +25,7 @@ final_path=$(ynh_app_setting_get $app final_path)
|
|||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_print_info "Removing dependencies"
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
@ -31,6 +33,7 @@ ynh_remove_app_dependencies
|
|||
#=================================================
|
||||
# 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
|
||||
|
@ -38,6 +41,7 @@ ynh_mysql_remove_db $db_name $db_name
|
|||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_print_info "Removing app main directory"
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove "$final_path"
|
||||
|
@ -45,12 +49,14 @@ ynh_secure_remove "$final_path"
|
|||
#=================================================
|
||||
# REMOVE LOG
|
||||
#=================================================
|
||||
ynh_print_info "Removing logs"
|
||||
|
||||
ynh_secure_remove "/var/log/$app"
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info "Removing nginx web server configuration"
|
||||
|
||||
# Remove the dedicated nginx config
|
||||
ynh_remove_nginx_config
|
||||
|
@ -58,6 +64,7 @@ ynh_remove_nginx_config
|
|||
#=================================================
|
||||
# REMOVE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info "Removing php-fpm configuration"
|
||||
|
||||
# Remove the dedicated php-fpm config
|
||||
ynh_remove_fpm_config
|
||||
|
@ -65,6 +72,7 @@ ynh_remove_fpm_config
|
|||
#=================================================
|
||||
# REMOVE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info "Removing logrotate configuration"
|
||||
|
||||
# Remove the app-specific logrotate config
|
||||
ynh_remove_logrotate
|
||||
|
@ -74,6 +82,13 @@ ynh_remove_logrotate
|
|||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_print_info "Removing the dedicated system user"
|
||||
|
||||
# Remove the user account
|
||||
ynh_system_user_delete $app
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info "Removal of $app completed"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
|
||||
#=================================================
|
||||
# GENERIC START
|
||||
#=================================================
|
||||
|
@ -20,6 +19,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# 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,12 +49,14 @@ ynh_restore_file "/etc/nginx/conf.d/${domain}.d/${app}.conf"
|
|||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_print_info "Restoring the app main directory..."
|
||||
|
||||
ynh_restore_file "$final_path"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_print_info "Recreating the dedicated system user..."
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create $app
|
||||
|
@ -83,6 +86,7 @@ ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf"
|
|||
#=================================================
|
||||
# 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
|
||||
|
@ -103,6 +107,13 @@ ynh_restore_file "/etc/logrotate.d/$app"
|
|||
#=================================================
|
||||
# RELOAD NGINX AND PHP-FPM
|
||||
#=================================================
|
||||
ynh_print_info "Reloading nginx web server and php-fpm..."
|
||||
|
||||
systemctl reload php7.0-fpm
|
||||
systemctl reload nginx
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info "Restoration completed for $app"
|
||||
|
|
|
@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info "Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -24,6 +25,7 @@ db_name=$(ynh_app_setting_get $app db_name)
|
|||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_print_info "Ensuring downward compatibility..."
|
||||
|
||||
# Fix is_public as a boolean value
|
||||
if [ "$is_public" = "Yes" ]; then
|
||||
|
@ -72,6 +74,7 @@ fi
|
|||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_print_info "Backing up the app before upgrading (may take a while)..."
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
|
@ -94,12 +97,14 @@ path_url=$(ynh_normalize_url_path $path_url)
|
|||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_print_info "Upgrading source files..."
|
||||
|
||||
ynh_setup_source "$final_path"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_print_info "Upgrading nginx web server configuration..."
|
||||
|
||||
# Copy and set nginx configuration
|
||||
ynh_add_nginx_config
|
||||
|
@ -107,6 +112,7 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_print_info "Upgrading dependencies..."
|
||||
|
||||
# Install dependencies
|
||||
ynh_install_app_dependencies php-cli
|
||||
|
@ -114,13 +120,15 @@ ynh_install_app_dependencies php-cli
|
|||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_print_info "Making sure dedicated system user exists..."
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create $app
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#================================================
|
||||
#=================================================
|
||||
ynh_print_info "Upgrading php-fpm configuration..."
|
||||
|
||||
# Create a dedicated php-fpm config
|
||||
ynh_add_fpm_config
|
||||
|
@ -130,6 +138,7 @@ ynh_add_fpm_config
|
|||
#=================================================
|
||||
# CREATE SETTINGS.PHP
|
||||
#=================================================
|
||||
ynh_print_info "Upgrading agendav configuration..."
|
||||
|
||||
# Generate random encryption key
|
||||
encryptkey=$(ynh_app_setting_get $app encryptkey)
|
||||
|
@ -169,6 +178,7 @@ ynh_store_file_checksum "$conf_path"
|
|||
#=================================================
|
||||
# RUN DATABASE MIGRATIONS (INCLUDES INITIALIZATION)
|
||||
#=================================================
|
||||
ynh_print_info "Upgrading agendav..."
|
||||
|
||||
(
|
||||
cd $final_path
|
||||
|
@ -178,6 +188,7 @@ ynh_store_file_checksum "$conf_path"
|
|||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_print_info "Upgrading logrotate configuration..."
|
||||
|
||||
mkdir -p $logdir
|
||||
chown -R $app: $logdir
|
||||
|
@ -204,6 +215,12 @@ chmod -R 750 ${final_path}/web/config/
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_print_info "Reloading nginx web server..."
|
||||
|
||||
# Reload services
|
||||
systemctl reload nginx
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info "Upgrade of $app completed"
|
||||
|
|
Loading…
Add table
Reference in a new issue