Merge pull request #124 from yalh76/patch-5

improving modify a config file step during upgrade
This commit is contained in:
yalh76 2020-05-31 00:46:05 +02:00 committed by GitHub
commit 5d16976184
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -147,12 +147,15 @@ ynh_add_fpm_config
#================================================= #=================================================
#================================================= #=================================================
# STORE THE CONFIG FILE CHECKSUM # MODIFY A CONFIG FILE
#================================================= #=================================================
### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. ### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. ### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
ynh_backup_if_checksum_is_different --file="$final_path/CONFIG_FILE" ynh_backup_if_checksum_is_different --file="$final_path/CONFIG_FILE"
ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$final_path/CONFIG_FILE"
# Recalculate and store the checksum of the file for the next upgrade. # Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$final_path/CONFIG_FILE" ynh_store_file_checksum --file="$final_path/CONFIG_FILE"