mirror of
https://github.com/YunoHost-Apps/snappymail_ynh.git
synced 2024-09-03 20:26:29 +02:00
cleaning
This commit is contained in:
parent
7dcd8289f2
commit
fff1309fcc
5 changed files with 42 additions and 16 deletions
|
@ -22,7 +22,7 @@ define('APP_DATA_FOLDER_PATH', '__DATA_DIR__');
|
|||
/**
|
||||
* Additional configuration file name
|
||||
*/
|
||||
//define('APP_CONFIGURATION_NAME', $_SERVER['HTTP_HOST'].'.ini');
|
||||
define('APP_CONFIGURATION_NAME', __DATA_DIR__'.ini');
|
||||
|
||||
/**
|
||||
* Also update extensions on upgrade
|
||||
|
|
|
@ -21,6 +21,13 @@ ynh_print_info --message="Declaring files to be backed up..."
|
|||
|
||||
ynh_backup --src_path="$install_dir"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE DATA DIR
|
||||
#=================================================
|
||||
|
||||
# Only relevant if there is a "data_dir" resource for this app
|
||||
ynh_backup --src_path="$data_dir" --is_big
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -41,6 +48,13 @@ ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
|||
|
||||
ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_print_info --message="Backing up the MySQL database..."
|
||||
|
||||
ynh_mysql_dump_db --database="$db_name" > db.sql
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -57,13 +57,9 @@ ynh_use_logrotate
|
|||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||
|
||||
mkdir -p "$install_dir/app/data/_data_/_default_/configs"
|
||||
chown $app:$app -R "$install_dir/app/data/_data_"
|
||||
|
||||
ynh_add_config --template="application.ini" --destination="$install_dir/app/data/_data_/_default_/configs/application.ini"
|
||||
|
||||
chmod 400 "$install_dir/app/data/_data_/_default_/configs/application.ini"
|
||||
chown $app:$app "$install_dir/app/data/_data_/_default_/configs/application.ini"
|
||||
ynh_add_config --template="application.ini" --destination="$data_dir/application.ini"
|
||||
chmod 400 "$data_dir/application.ini"
|
||||
chown $app:$app "$data_dir/application.ini"
|
||||
|
||||
ynh_add_config --template="include.php" --destination="$install_dir/include.php"
|
||||
chmod 400 "$install_dir/include.php"
|
||||
|
@ -74,7 +70,7 @@ chown $app:$app "$install_dir/include.php"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Applying SSO patch..." --weight=1
|
||||
|
||||
ynh_add_config --template="../conf/sso.php" --destination="$install_dir/index.php"
|
||||
ynh_add_config --template="sso.php" --destination="$install_dir/index.php"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -20,13 +20,29 @@ ynh_restore_file --origin_path="$install_dir"
|
|||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the data directory..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="$data_dir" --not_mandatory
|
||||
|
||||
# (Same as for install dir)
|
||||
chown -R $app:www-data "$data_dir"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the MySQL database..." --weight=1
|
||||
|
||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=4
|
||||
|
||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ then
|
|||
ynh_script_progression --message="Upgrading source files..." --weight=5
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$install_dir/app" --keep="data/_data_/_default_/configs/application.ini"
|
||||
ynh_setup_source --dest_dir="$install_dir/app"
|
||||
fi
|
||||
|
||||
chmod -R o-rwx "$install_dir"
|
||||
|
@ -70,7 +70,7 @@ chown -R $app:www-data "$install_dir"
|
|||
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=5
|
||||
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
|
||||
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
@ -85,17 +85,17 @@ ynh_use_logrotate --non-append
|
|||
#=================================================
|
||||
ynh_script_progression --message="Updating a configuration file..." --weight=1
|
||||
|
||||
ynh_add_config --template="application.ini" --destination="$install_dir/app/data/_data_/_default_/configs/application.ini"
|
||||
ynh_add_config --template="application.ini" --destination="$data_dir/application.ini"
|
||||
|
||||
chmod 400 "$install_dir/app/data/_data_/_default_/configs/application.ini"
|
||||
chown $app:$app "$install_dir/app/data/_data_/_default_/configs/application.ini"
|
||||
chmod 400 "$data_dir/application.ini"
|
||||
chown $app:$app "$data_dir/application.ini"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSO
|
||||
#=================================================
|
||||
ynh_script_progression --message="Applying SSO patch..." --weight=1
|
||||
|
||||
ynh_add_config --template="../conf/sso.php" --destination="$install_dir/index.php"
|
||||
ynh_add_config --template="sso.php" --destination="$install_dir/index.php"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
Loading…
Add table
Reference in a new issue