1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/emailpoubelle_ynh.git synced 2024-09-03 18:26:29 +02:00
This commit is contained in:
ericgaspar 2021-06-24 10:44:35 +02:00
parent 757470c673
commit 9f79f82027
No known key found for this signature in database
GPG key ID: 574F281483054D44
7 changed files with 53 additions and 30 deletions

View file

@ -20,6 +20,7 @@
"services": [
"nginx",
"mysql",
"php7.3-fpm",
"dovecot",
"postfix"
],

View file

@ -2,6 +2,8 @@
# COMMON VARIABLES
#=================================================
pkg_dependencies="php-geoip php7.0-cli"
YNH_PHP_VERSION="7.3"
extra_php_dependencies="php-geoip php${YNH_PHP_VERSION}-cli"
app="emailpoubelle"
lang="fr_FR.UTF-8 en_US.UTF-8 it_IT.UTF-8"

View file

@ -43,6 +43,12 @@ ynh_backup --src_path="$final_path"
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP THE PHP-FPM CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================

View file

@ -60,8 +60,6 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=15
ynh_install_app_dependencies $pkg_dependencies
#install locale (nginx will restart at the end of the install)
for i in $lang ; do
ynh_replace_string "# $i" "$i" /etc/locale.gen
@ -104,7 +102,6 @@ ynh_add_config --template="../conf/conf-dist.php" --destination="$final_path/con
chmod 400 "$final_path/conf.php"
#chown $app:$app "$final_path/conf.php"
#setting postfix to use virtual aliases file
# Add postfix configuration hook and regen postfix conf
cp -R ../sources/hooks/conf_regen/98-postfix_emailpoubelle /usr/share/yunohost/hooks/conf_regen/
@ -132,6 +129,15 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1
ynh_add_nginx_config
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --package="$extra_php_dependencies"
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# SETUP SSOWAT
#=================================================

View file

@ -29,14 +29,6 @@ ynh_script_progression --message="Removing the MySQL database..."
# Remove a database if it exists, along with the associated user
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# REMOVE APP MAIN DIR
#=================================================
@ -53,6 +45,14 @@ ynh_script_progression --message="Removing nginx web server configuration..."
# Remove the dedicated nginx config
ynh_remove_nginx_config
#=================================================
# REMOVE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=3
# Remove the dedicated PHP-FPM config
ynh_remove_fpm_config
#=================================================
# SPECIFIC REMOVE
#=================================================

View file

@ -41,9 +41,6 @@ ynh_webpath_available $domain $path_url \
test ! -d $final_path \
|| ynh_die "There is already a directory: $final_path "
# Check user
ynh_user_exists "$admin"
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
@ -57,16 +54,25 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_restore_file "$final_path"
ynh_restore_file --origin_path="$final_path"
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=50
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_add_fpm_config --package="$extra_php_dependencies"
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Restoring the MySQL database..." --weight=1
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
ynh_mysql_setup_db $db_name $db_name $db_pwd
ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#=================================================
# SPECIFIC RESTORATION
@ -75,8 +81,6 @@ ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=15
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#Check & regen local
for i in $lang ; do
ynh_replace_string "# $i" "$i" /etc/locale.gen
@ -113,7 +117,7 @@ ynh_restore_file "/etc/cron.d/$app"
ynh_script_progression --message="Reloading nginx web server and php-fpm..." --weight=1
postmap $final_path/var/virtual
ynh_systemd_action --service_name=php7.0-fpm --action=restart
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload
ynh_systemd_action --service_name=postfix --action=reload

View file

@ -21,6 +21,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
admin=$(ynh_app_setting_get --app=$app --key=admin)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# CHECK VERSION
@ -77,11 +78,12 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." -
ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading dependencies..."
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
ynh_install_app_dependencies $pkg_dependencies
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --package="$extra_php_dependencies"
#=================================================
#INSTALL SOURCES
@ -98,14 +100,12 @@ fi
#Temporaire - mettre en config
if [ ! -e $final_path/lang/fr_FR ]; then
ln -s $final_path/lang/fr $final_path/lang/fr_FR
ln -s $final_path/lang/fr $final_path/lang/fr_FR
fi
if [ ! -e $final_path/lang/it_IT ]; then
ln -s $final_path/lang/it $final_path/lang/it_IT
ln -s $final_path/lang/it $final_path/lang/it_IT
fi
#setting postfix to use virtual aliases file
# Add postfix configuration hook and regen postfix conf
#setting postfix to use virtual aliases file
# Add postfix configuration hook and regen postfix conf
cp -R ../sources/hooks/conf_regen/98-postfix_emailpoubelle /usr/share/yunohost/hooks/conf_regen/
@ -123,7 +123,7 @@ chown root:root /etc/cron.d/$app
# RELOAD SERVICES
#=================================================
ynh_script_progression --message="Starting a systemd service..."
ynh_systemd_action --service_name=php7.0-fpm --action=restart
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
ynh_script_progression --message="Reloading nginx web server..."
ynh_systemd_action --service_name=nginx --action=reload
@ -131,4 +131,8 @@ ynh_systemd_action --service_name=nginx --action=reload
ynh_script_progression --message="Reloading postfix..."
ynh_systemd_action --service_name=postfix --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last