diff --git a/conf/config.local.php b/conf/config.local.php index 0080731..11a00bf 100644 --- a/conf/config.local.php +++ b/conf/config.local.php @@ -6,4 +6,4 @@ * Pour ajouter vos configurations personnalisées, rendez-vous dans le fichier config.local.user.php */ require '__INSTALL_DIR__/config.local.yunohost.php'; -require '__INSTALL_DIR__/config.local.user.php'; +require '__INSTALL_DIR__/data/config.local.user.php'; diff --git a/conf/config.local.yunohost.php b/conf/config.local.yunohost.php index 41849cf..3cd4e76 100644 --- a/conf/config.local.yunohost.php +++ b/conf/config.local.yunohost.php @@ -5,7 +5,7 @@ * * Ce fichier sera mis à jour à chaque nouvelle version de Yunohost * - * Pour ajouter vos configurations personnalisées, rendez-vous dans le fichier config.local.user.php + * Pour ajouter vos configurations personnalisées, rendez-vous dans le fichier data/config.local.user.php * */ diff --git a/scripts/install b/scripts/install index d76907c..eaf582e 100644 --- a/scripts/install +++ b/scripts/install @@ -50,7 +50,7 @@ ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key # Install configuration files ynh_add_config --template="config.local.php" --destination="$install_dir/config.local.php" ynh_add_config --template="config.local.yunohost.php" --destination="$install_dir/config.local.yunohost.php" -ynh_add_config --template="config.local.user.php" --destination="$install_dir/config.local.user.php" +ynh_add_config --template="config.local.user.php" --destination="$install_dir/data/config.local.user.php" # Permissions on files and directories chmod -R o-rwx "$install_dir" @@ -61,7 +61,7 @@ find "$install_dir/data" -type d -exec chmod 770 {} + find "$install_dir/data" -type f -exec chmod 660 {} + chmod 440 "$install_dir/config.local.php" chmod 440 "$install_dir/config.local.yunohost.php" -chmod 660 "$install_dir/config.local.user.php" +chmod 660 "$install_dir/data/config.local.user.php" #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index c1ab315..dc0c5de 100644 --- a/scripts/restore +++ b/scripts/restore @@ -26,7 +26,12 @@ find "$install_dir/data" -type d -exec chmod 770 {} + find "$install_dir/data" -type f -exec chmod 660 {} + chmod 440 "$install_dir/config.local.php" chmod 440 "$install_dir/config.local.yunohost.php" + +if ynh_compare_current_package_version --comparison le --version 1.2.11~ynh4; then chmod 660 "$install_dir/config.local.user.php" +else +chmod 660 "$install_dir/data/config.local.user.php" +fi #================================================= # RESTORE THE PHP-FPM CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 4b99aab..417f46d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -30,14 +30,19 @@ if [[ -z "${secret_key:-}" ]]; then fi #================================================= -# BACKUP SQLITE DATABASE AND DATAS +# BACKUP DATABASE, DATAS AND CONFIG LOCAL USER #================================================= ynh_script_progression --message="Backup of the DB in temporary file...." --weight=5 + # copy data directory backup tmp_data_backup=$(mktemp -d) rsync -a $install_dir/data/ $tmp_data_backup/ +if ynh_compare_current_package_version --comparison le --version 1.2.11~ynh4; then + mv $install_dir/config.local.user.php $tmp_data_backup/ +fi + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -47,7 +52,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" --keep="config.local.user.php" --full_replace=1 + ynh_setup_source --dest_dir="$install_dir" --full_replace=1 fi chmod -R o-rwx "$install_dir" @@ -78,7 +83,7 @@ ynh_script_progression --message="Updating a configuration file..." --weight=5 if ynh_compare_current_package_version --comparison lt --version 1.1.15~ynh1; then chmod 750 "$install_dir/config.local.user.php" - ynh_add_config --template="config.local.user.php" --destination="$install_dir/config.local.user.php" + ynh_add_config --template="config.local.user.php" --destination="$install_dir/data/config.local.user.php" fi # NOTE: Don't overwrite config.local.user.php @@ -107,7 +112,7 @@ find "$install_dir/data" -type d -exec chmod 770 {} + find "$install_dir/data" -type f -exec chmod 660 {} + chmod 440 "$install_dir/config.local.php" chmod 440 "$install_dir/config.local.yunohost.php" -chmod 660 "$install_dir/config.local.user.php" +chmod 660 "$install_dir/data/config.local.user.php" #================================================= # FINALISE UPGRADE