mirror of
https://github.com/YunoHost-Apps/nextcloud_ynh.git
synced 2024-09-03 19:55:57 +02:00
[fix] checksum helper
This commit is contained in:
parent
1a6540219e
commit
e585e55cb2
1 changed files with 13 additions and 1 deletions
|
@ -191,6 +191,18 @@ ynh_remove_logrotate () {
|
||||||
sudo rm "/etc/logrotate.d/$app"
|
sudo rm "/etc/logrotate.d/$app"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Calculate and store a file checksum into the app settings
|
||||||
|
#
|
||||||
|
# $app should be defined when calling this helper
|
||||||
|
#
|
||||||
|
# usage: ynh_store_file_checksum file
|
||||||
|
# | arg: file - The file on which the checksum will performed, then stored.
|
||||||
|
ynh_store_file_checksum () {
|
||||||
|
local checksum_setting_name=checksum_${1//[\/ ]/_} # Replace all '/' and ' ' by '_'
|
||||||
|
ynh_app_setting_set $app $checksum_setting_name $(sudo md5sum "$1" | cut -d' ' -f1)
|
||||||
|
}
|
||||||
|
|
||||||
# Verify the checksum and backup the file if it's different
|
# Verify the checksum and backup the file if it's different
|
||||||
# This helper is primarily meant to allow to easily backup personalised/manually
|
# This helper is primarily meant to allow to easily backup personalised/manually
|
||||||
# modified config files.
|
# modified config files.
|
||||||
|
@ -246,7 +258,7 @@ ynh_add_fpm_config () {
|
||||||
ynh_backup_if_checksum_is_different "$finalphpini" 1
|
ynh_backup_if_checksum_is_different "$finalphpini" 1
|
||||||
sudo cp ../conf/php-fpm.ini "$finalphpini"
|
sudo cp ../conf/php-fpm.ini "$finalphpini"
|
||||||
sudo chown root: "$finalphpini"
|
sudo chown root: "$finalphpini"
|
||||||
ynh_store_checksum_config "$finalphpini"
|
ynh_store_file_checksum "$finalphpini"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo systemctl reload php5-fpm
|
sudo systemctl reload php5-fpm
|
||||||
|
|
Loading…
Add table
Reference in a new issue