mirror of
https://github.com/YunoHost-Apps/rainloop_ynh.git
synced 2024-09-03 20:16:18 +02:00
Add progression with ynh_print_info
This commit is contained in:
parent
3d11de2bbc
commit
deb9810068
6 changed files with 69 additions and 1 deletions
|
@ -13,7 +13,7 @@
|
||||||
"name": "scith, Djip007, polytan02"
|
"name": "scith, Djip007, polytan02"
|
||||||
},
|
},
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 2.7.2"
|
"yunohost": ">= 3.2.0"
|
||||||
},
|
},
|
||||||
"multi_instance": true,
|
"multi_instance": true,
|
||||||
"services": [
|
"services": [
|
||||||
|
|
|
@ -19,6 +19,7 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -31,18 +32,21 @@ db_name=$(ynh_app_setting_get $app db_name)
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Backing up the main app directory..."
|
||||||
|
|
||||||
ynh_backup "$final_path"
|
ynh_backup "$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Backing up nginx web server configuration..."
|
||||||
|
|
||||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE PHP-FPM CONFIGURATION
|
# BACKUP THE PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Backing up php-fpm configuration..."
|
||||||
|
|
||||||
ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
|
ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
|
||||||
ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini"
|
ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini"
|
||||||
|
@ -50,5 +54,12 @@ ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini"
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE MYSQL DATABASE
|
# BACKUP THE MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Backing up the MySQL database..."
|
||||||
|
|
||||||
ynh_mysql_dump_db "$db_name" > db.sql
|
ynh_mysql_dump_db "$db_name" > db.sql
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||||
|
|
|
@ -32,6 +32,7 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Validating installation parameters..."
|
||||||
|
|
||||||
final_path=/var/www/$app
|
final_path=/var/www/$app
|
||||||
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
test ! -e "$final_path" || ynh_die "This path already contains a folder"
|
||||||
|
@ -45,6 +46,7 @@ ynh_webpath_register $app $domain $path_url
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Storing installation settings..."
|
||||||
|
|
||||||
ynh_app_setting_set $app domain $domain
|
ynh_app_setting_set $app domain $domain
|
||||||
ynh_app_setting_set $app path $path_url
|
ynh_app_setting_set $app path $path_url
|
||||||
|
@ -57,6 +59,7 @@ ynh_app_setting_set $app ldap $ldap
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A MYSQL DATABASE
|
# CREATE A MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Creating a MySQL database..."
|
||||||
|
|
||||||
db_name=$(ynh_sanitize_dbid $app)
|
db_name=$(ynh_sanitize_dbid $app)
|
||||||
ynh_app_setting_set $app db_name $db_name
|
ynh_app_setting_set $app db_name $db_name
|
||||||
|
@ -65,6 +68,7 @@ ynh_mysql_setup_db $db_name $db_name
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Setting up source files..."
|
||||||
|
|
||||||
ynh_app_setting_set $app final_path $final_path
|
ynh_app_setting_set $app final_path $final_path
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
|
@ -73,6 +77,7 @@ ynh_setup_source "$final_path/app"
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Configuring nginx web server..."
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
@ -80,6 +85,7 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Configuring system user..."
|
||||||
|
|
||||||
# Create a system user
|
# Create a system user
|
||||||
ynh_system_user_create $app
|
ynh_system_user_create $app
|
||||||
|
@ -87,6 +93,7 @@ ynh_system_user_create $app
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Configuring php-fpm..."
|
||||||
|
|
||||||
# Create a dedicated php-fpm config
|
# Create a dedicated php-fpm config
|
||||||
ynh_add_fpm_config
|
ynh_add_fpm_config
|
||||||
|
@ -96,6 +103,7 @@ ynh_add_fpm_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# AUTOCONFIG
|
# AUTOCONFIG
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Configuring rainloop..."
|
||||||
|
|
||||||
# Set lang => define from install manifest
|
# Set lang => define from install manifest
|
||||||
case "$lang" in
|
case "$lang" in
|
||||||
|
@ -173,6 +181,7 @@ chown -R $app: $final_path
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Configuring SSOwat..."
|
||||||
|
|
||||||
# Make app public if necessary
|
# Make app public if necessary
|
||||||
if [ $is_public -eq 1 ]
|
if [ $is_public -eq 1 ]
|
||||||
|
@ -183,5 +192,12 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Reloading nginx web server..."
|
||||||
|
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info "Installation of $app completed"
|
||||||
|
|
|
@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -24,6 +25,7 @@ final_path=$(ynh_app_setting_get $app final_path)
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE THE MYSQL DATABASE
|
# REMOVE THE MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Removing the MySQL database"
|
||||||
|
|
||||||
# Remove a database if it exists, along with the associated user
|
# Remove a database if it exists, along with the associated user
|
||||||
ynh_mysql_remove_db $db_name $db_name
|
ynh_mysql_remove_db $db_name $db_name
|
||||||
|
@ -31,6 +33,7 @@ ynh_mysql_remove_db $db_name $db_name
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE APP MAIN DIR
|
# REMOVE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Removing app main directory"
|
||||||
|
|
||||||
# Remove the app directory securely
|
# Remove the app directory securely
|
||||||
ynh_secure_remove "$final_path"
|
ynh_secure_remove "$final_path"
|
||||||
|
@ -38,6 +41,7 @@ ynh_secure_remove "$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Removing nginx web server configuration"
|
||||||
|
|
||||||
# Remove the dedicated nginx config
|
# Remove the dedicated nginx config
|
||||||
ynh_remove_nginx_config
|
ynh_remove_nginx_config
|
||||||
|
@ -45,6 +49,7 @@ ynh_remove_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE PHP-FPM CONFIGURATION
|
# REMOVE PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Removing php-fpm configuration"
|
||||||
|
|
||||||
# Remove the dedicated php-fpm config
|
# Remove the dedicated php-fpm config
|
||||||
ynh_remove_fpm_config
|
ynh_remove_fpm_config
|
||||||
|
@ -54,6 +59,7 @@ ynh_remove_fpm_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE GPG KEY
|
# REMOVE GPG KEY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Removing GPG key"
|
||||||
|
|
||||||
gpg --batch --delete-key --yes Rainloop
|
gpg --batch --delete-key --yes Rainloop
|
||||||
|
|
||||||
|
@ -62,6 +68,13 @@ gpg --batch --delete-key --yes Rainloop
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEDICATED USER
|
# REMOVE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Removing the dedicated system user"
|
||||||
|
|
||||||
# Delete a system user
|
# Delete a system user
|
||||||
ynh_system_user_delete $app
|
ynh_system_user_delete $app
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info "Removal of $app completed"
|
||||||
|
|
|
@ -19,6 +19,7 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Loading settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -30,6 +31,7 @@ db_name=$(ynh_app_setting_get $app db_name)
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Validating restoration parameters..."
|
||||||
|
|
||||||
ynh_webpath_available $domain $path_url \
|
ynh_webpath_available $domain $path_url \
|
||||||
|| ynh_die "Path not available: ${domain}${path_url}"
|
|| ynh_die "Path not available: ${domain}${path_url}"
|
||||||
|
@ -47,12 +49,14 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Restoring the app main directory..."
|
||||||
|
|
||||||
ynh_restore_file "$final_path"
|
ynh_restore_file "$final_path"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE MYSQL DATABASE
|
# RESTORE THE MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Restoring the MySQL database..."
|
||||||
|
|
||||||
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
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
|
||||||
|
@ -61,6 +65,7 @@ ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql
|
||||||
#=================================================
|
#=================================================
|
||||||
# RECREATE THE DEDICATED USER
|
# RECREATE THE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Recreating the dedicated system user..."
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
# Create the dedicated user (if not existing)
|
||||||
ynh_system_user_create $app
|
ynh_system_user_create $app
|
||||||
|
@ -84,6 +89,13 @@ ynh_restore_file "/etc/php5/fpm/conf.d/20-$app.ini"
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX AND PHP-FPM
|
# RELOAD NGINX AND PHP-FPM
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Reloading nginx web server and php-fpm..."
|
||||||
|
|
||||||
systemctl reload php5-fpm
|
systemctl reload php5-fpm
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info "Restoration completed for $app"
|
||||||
|
|
|
@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -24,6 +25,7 @@ db_name=$(ynh_app_setting_get $app db_name)
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Ensuring downward compatibility..."
|
||||||
|
|
||||||
# Fix is_public as a boolean value
|
# Fix is_public as a boolean value
|
||||||
if [ "$is_public" = "Yes" ]; then
|
if [ "$is_public" = "Yes" ]; then
|
||||||
|
@ -49,6 +51,7 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# 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
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
|
@ -71,6 +74,7 @@ path_url=$(ynh_normalize_url_path $path_url)
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Upgrading source files..."
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source "$final_path"
|
ynh_setup_source "$final_path"
|
||||||
|
@ -78,6 +82,7 @@ ynh_setup_source "$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Upgrading nginx web server configuration..."
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
@ -85,6 +90,7 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Making sure dedicated system user exists..."
|
||||||
|
|
||||||
# Create a dedicated user (if not existing)
|
# Create a dedicated user (if not existing)
|
||||||
ynh_system_user_create $app
|
ynh_system_user_create $app
|
||||||
|
@ -92,6 +98,7 @@ ynh_system_user_create $app
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM CONFIGURATION
|
# PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Upgrading php-fpm configuration..."
|
||||||
|
|
||||||
# Create a dedicated php-fpm config
|
# Create a dedicated php-fpm config
|
||||||
ynh_add_fpm_config
|
ynh_add_fpm_config
|
||||||
|
@ -101,6 +108,7 @@ ynh_add_fpm_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPDATE SSO AND PGP
|
# UPDATE SSO AND PGP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Upgrading rainloop configuration..."
|
||||||
|
|
||||||
# update SSO
|
# update SSO
|
||||||
cp ../sources/sso/sso.php "$final_path/index.php"
|
cp ../sources/sso/sso.php "$final_path/index.php"
|
||||||
|
@ -129,6 +137,7 @@ chown -R $app: $final_path
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Upgrading SSOwat configuration..."
|
||||||
|
|
||||||
# Make app public if necessary
|
# Make app public if necessary
|
||||||
if [ $is_public -eq 1 ]
|
if [ $is_public -eq 1 ]
|
||||||
|
@ -139,5 +148,12 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info "Reloading nginx web server..."
|
||||||
|
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info "Upgrade of $app completed"
|
||||||
|
|
Loading…
Reference in a new issue