mirror of
https://github.com/YunoHost-Apps/weblate_ynh.git
synced 2024-10-01 13:35:04 +02:00
add new helper ynh_check_if_checksum_is_different
This commit is contained in:
parent
3736c4deca
commit
8b51355bce
2 changed files with 53 additions and 28 deletions
|
@ -24,6 +24,20 @@ weblate_fill_settings() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ynh_check_if_checksum_is_different() {
|
||||||
|
local file=$1
|
||||||
|
local checksum_setting_name=checksum_${file//[\/ ]/_} # Replace all '/' and ' ' by '_'
|
||||||
|
local checksum_value=$(ynh_app_setting_get $app $checksum_setting_name)
|
||||||
|
local check=0
|
||||||
|
|
||||||
|
if ! echo "$checksum_value $file" | sudo md5sum -c --status
|
||||||
|
then # If the checksum is now different
|
||||||
|
check=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
return "$check"
|
||||||
|
}
|
||||||
|
|
||||||
ynh_psql_test_if_first_run() {
|
ynh_psql_test_if_first_run() {
|
||||||
if [ -f /etc/yunohost/psql ];
|
if [ -f /etc/yunohost/psql ];
|
||||||
then
|
then
|
||||||
|
|
|
@ -131,6 +131,11 @@ fi
|
||||||
"${final_path}/venv/bin/pip" install django_sendmail_backend
|
"${final_path}/venv/bin/pip" install django_sendmail_backend
|
||||||
)
|
)
|
||||||
|
|
||||||
|
check=$(ynh_check_if_checksum_is_different "$settings")
|
||||||
|
|
||||||
|
if [[ "$check" -eq 1 ]]
|
||||||
|
then
|
||||||
|
echo "Settings.py was modified localy, running diff before using the new default file for $current_version."
|
||||||
# generate previous defaults settings
|
# generate previous defaults settings
|
||||||
cp "$previous_version_file" "$old_settings"
|
cp "$previous_version_file" "$old_settings"
|
||||||
weblate_fill_settings "$old_settings"
|
weblate_fill_settings "$old_settings"
|
||||||
|
@ -170,6 +175,12 @@ Your administrator may have to update your settings.py to have a fully working i
|
||||||
"
|
"
|
||||||
|
|
||||||
echo "$mail_subject" | mail -s "$mail_subject" "$admin_mail"
|
echo "$mail_subject" | mail -s "$mail_subject" "$admin_mail"
|
||||||
|
else
|
||||||
|
echo "Settings.py was not modified, using the new default file for $current_version."
|
||||||
|
# generate new defaults settings
|
||||||
|
cp ../conf/settings.py "$settings"
|
||||||
|
weblate_fill_settings "$settings"
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Run migration scripts
|
# Run migration scripts
|
||||||
|
|
Loading…
Reference in a new issue