diff --git a/scripts/install b/scripts/install index 4b48fb9..8ae9a48 100755 --- a/scripts/install +++ b/scripts/install @@ -15,12 +15,12 @@ source /usr/share/yunohost/helpers path="/Microsoft-Server-ActiveSync" timezone="$(cat /etc/timezone)" -log_dir="/var/log/$app" +log_dir="/var/log/$app/" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --weight=1 +ynh_script_progression --message="Setting up source files..." # Download, check integrity, uncompress and patch the source from app.src mkdir -p "$install_dir/tmp" @@ -34,7 +34,7 @@ chown -R $app:www-data "$install_dir" #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring PHP-FPM..." --weight=1 +ynh_script_progression --message="Installing system configurations..." # Create a dedicated PHP-FPM config ynh_add_fpm_config @@ -42,20 +42,17 @@ ynh_add_fpm_config # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# CREATE FINAL LOG PATH -#================================================= -ynh_script_progression --message="Creating a final log path..." --weight=1 - mkdir -p $log_dir chmod 750 "$log_dir" chmod -R o-rwx "$log_dir" chown -R $app:www-data "$log_dir" +ynh_use_logrotate + #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Adding a configuration file..." --weight=1 +ynh_script_progression --message="Adding a configuration file..." # Enable caldav carddav support if yunohost app list | grep -q 'id: baikal' ; then @@ -122,15 +119,6 @@ ynh_add_config --template="backend/config-searchldap.php" --destination="$instal #Copy XMLElement.php ln -s /usr/share/awl/inc/XML* /var/www/$app/include/ -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." --weight=1 - -# Use logrotate to manage application logfile(s) -ynh_use_logrotate #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index 739d7bc..e980697 100755 --- a/scripts/restore +++ b/scripts/restore @@ -40,6 +40,11 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/logrotate.d/$app" +mkdir -p $log_dir +chmod 750 "$log_dir" +chmod -R o-rwx "$log_dir" +chown -R $app:www-data "$log_dir" + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index fa2a4f5..2f88a74 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -16,7 +16,7 @@ source /usr/share/yunohost/helpers upgrade_type=$(ynh_check_app_version_changed) timezone="$(cat /etc/timezone)" -log_dir="/var/log/$app" +log_dir="/var/log/$app/" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -24,7 +24,7 @@ log_dir="/var/log/$app" if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Upgrading source files..." --weight=1 + ynh_script_progression --message="Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src mkdir "$install_dir/tmp" @@ -39,7 +39,7 @@ chown -R $app:www-data "$install_dir" #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1 +ynh_script_progression --message="Installing system configurations..." # Create a dedicated PHP-FPM config ynh_add_fpm_config @@ -47,12 +47,19 @@ ynh_add_fpm_config # Create a dedicated NGINX config ynh_add_nginx_config +mkdir -p $log_dir +chmod 750 "$log_dir" +chmod -R o-rwx "$log_dir" +chown -R $app:www-data "$log_dir" + +ynh_use_logrotate --non-append + #================================================= # SPECIFIC UPGRADE #================================================= # UPDATE A CONFIG FILE #================================================= -ynh_script_progression --message="Updating a config file..." --weight=1 +ynh_script_progression --message="Updating a config file..." # Enable caldav carddav support if yunohost app list | grep -q 'id: baikal' ; then @@ -119,16 +126,6 @@ ynh_add_config --template="backend/config-searchldap.php" --destination="$instal # Fixstates to avoid full resync of devices after version upgrades $install_dir/z-push-admin.php -a fixstates -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 - -# Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append - #================================================= # END OF SCRIPT #=================================================