1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/galette_ynh.git synced 2024-09-03 18:36:28 +02:00
This commit is contained in:
ericgaspar 2021-07-22 15:51:13 +02:00
parent 8c84b84bb6
commit 105b041bd1
5 changed files with 61 additions and 67 deletions

View file

@ -428,3 +428,4 @@ chdir = __FINALPATH__
; php_admin_value[max_input_time] = 300
; php_admin_value[memory_limit] = 256M
; php_admin_flag[short_open_tag] = On
php_admin_value[date.timezone] = __TIMEZONE__

View file

@ -20,11 +20,12 @@ ynh_abort_if_errors
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
app=$YNH_APP_INSTANCE_NAME
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
timezone="$(cat /etc/timezone)"
app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
@ -46,9 +47,6 @@ ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
#=================================================
<<<<<<< Updated upstream
# CREATE A POSTGRESQL DATABASE
=======
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=20
@ -56,8 +54,7 @@ ynh_script_progression --message="Installing dependencies..." --weight=20
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE A MYSQL DATABASE
>>>>>>> Stashed changes
# CREATE A POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2
@ -83,12 +80,12 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
mv "$final_path"/galette/* "$final_path"/
ynh_secure_remove "$final_path"/tests
mv $final_path/galette/* $final_path/
ynh_secure_remove $final_path/tests
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chmod 750 $final_path
chmod -R o-rwx $final_path
chown -R $app:www-data $final_path
#=================================================
# NGINX CONFIGURATION
@ -115,7 +112,7 @@ ynh_script_progression --message="Configuring Galette..." --weight=1
ynh_add_config --template="../conf/config.inc.php.dist" --destination="$final_path/config/config.inc.php"
chown $app $final_path/config
chmod 750 $final_path/config
chmod 775 $final_path/config
#=================================================
# GENERIC FINALIZATION
@ -132,6 +129,7 @@ done
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=1
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
@ -144,7 +142,7 @@ ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary or protect it
if [ $is_public -eq 1 ]
then
ynh_permission_update --permission "main" --add "visitors"
ynh_permission_update --permission="main" --add="visitors"
fi
#=================================================

View file

@ -1,6 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
@ -30,8 +29,6 @@ ynh_script_progression --message="Removing the PostgreSQL database..." --weight=
# Remove a database if it exists, along with the associated user
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
<<<<<<< Updated upstream
=======
#=================================================
# REMOVE DEPENDENCIES
@ -40,7 +37,6 @@ ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
>>>>>>> Stashed changes
#=================================================
# REMOVE APP MAIN DIR

View file

@ -1,6 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
@ -46,7 +45,7 @@ test ! -d $final_path \
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
@ -68,6 +67,14 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=1
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_add_fpm_config --package="$extra_php_dependencies"
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
@ -89,32 +96,20 @@ ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
# RESTORE USER RIGHTS
#=================================================
# Restore permissions on app files
chown -R root: "$final_path"
chown "$app" "$final_path/config"
chmod 750 "$final_path/config"
for folder in attachments cache exports files imports logs photos templates_c tempimages
do
chown "$app" "$final_path/data/$folder"
chmod 750 "$final_path/data/$folder"
chmod 775 "$final_path/data/$folder"
done
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Reconfiguring PHP-FPM..." --weight=10
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_add_fpm_config --package="$extra_php_dependencies"
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_restore_file "/etc/logrotate.d/$app"
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
# GENERIC FINALIZATION

View file

@ -1,11 +1,4 @@
#!/bin/bash
#
#
# No upgrade script is available at the moment.
#
# If you really need to upgrade, please check the official documentation :
# http://galette.eu/documentation/fr/installation/update.html
#
#=================================================
# GENERIC START
@ -30,6 +23,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
timezone="$(cat /etc/timezone)"
#=================================================
# CHECK VERSION
@ -37,6 +31,20 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
@ -60,19 +68,12 @@ if [ -z "$final_path" ]; then
ynh_app_setting_set "$app" final_path "$final_path"
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up $app before upgrading (may take a while)..." --weight=7
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# CREATE DEDICATED USER
@ -88,6 +89,8 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
# Download, check integrity, uncompress and patch the source from app.src
mv "$final_path" "$final_path.old"
@ -102,6 +105,7 @@ fi
# delete temp directory
ynh_secure_remove "$final_path.old"
fi
#=================================================
# NGINX CONFIGURATION
@ -147,7 +151,7 @@ chmod 750 "$final_path/config"
for folder in attachments cache exports files imports logs photos templates_c tempimages
do
chown "$app" "$final_path/data/$folder"
chmod 750 "$final_path/data/$folder"
chmod 775 "$final_path/data/$folder"
done
#=================================================