diff --git a/scripts/install b/scripts/install index 69288af..f15501a 100755 --- a/scripts/install +++ b/scripts/install @@ -128,6 +128,8 @@ sudo cp ../conf/logging /etc/$app/ sudo cp ../conf/rights /etc/$app/ sudo sed -i "s@__PATH__@$path@g" /etc/$app/config sudo sed -i "s@__FINALPATH__@$final_path@g" /etc/$app/config +sudo yunohost app setting $app config_file_md5 -v $(md5sum "/etc/$app/config" | cut -d' ' -f1) +sudo yunohost app setting $app logging_file_md5 -v $(md5sum "/etc/$app/logging" | cut -d' ' -f1) if [ "$infcloud" = "1" ] then #Configuration InfCloud # Détermine la langue @@ -170,6 +172,7 @@ then #Configuration InfCloud sudo sed -i "s@__LANG__@$language@g" "$final_path/infcloud/config.js" sudo sed -i "s@__ADMIN__@$admin@g" "$final_path/infcloud/config.js" sudo sed -i "s@__TIMEZONE__@$(cat /etc/timezone)@g" "$final_path/infcloud/config.js" + sudo yunohost app setting $app config.js_file_md5 -v $(md5sum "$final_path/infcloud/config.js" | cut -d' ' -f1) fi # Set permissions to radicale directory diff --git a/scripts/upgrade b/scripts/upgrade index 04dd906..a903e02 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -55,7 +55,15 @@ then #Instal InfCloud fi # Radicale configuration +config_file="/etc/$app/config" +if [ "$(sudo yunohost app setting $app config_file_md5)" != $(md5sum "$config_file" | cut -d' ' -f1) ]; then + sudo cp -a "$config_file" "$config_file.backup.$(date '+%d.%m.%y_%Hh%M,%Ss')" # Si le fichier de config a été modifié, créer un backup. +fi sudo cp ../conf/config /etc/$app/ +config_file="/etc/$app/logging" +if [ "$(sudo yunohost app setting $app logging_file_md5)" != $(md5sum "$config_file" | cut -d' ' -f1) ]; then + sudo cp -a "$config_file" "$config_file.backup.$(date '+%d.%m.%y_%Hh%M,%Ss')" # Si le fichier de config a été modifié, créer un backup. +fi sudo cp ../conf/logging /etc/$app/ sudo sed -i "s@__PATH__@$path@g" /etc/$app/config sudo sed -i "s@__FINALPATH__@$path@g" /etc/$app/config @@ -95,6 +103,10 @@ then #Configuration InfCloud ;; esac sudo yunohost app setting $app language -v $language + config_file="$final_path/infcloud/config.js" + if [ "$(sudo yunohost app setting $app config.js_file_md5)" != $(md5sum "$config_file" | cut -d' ' -f1) ]; then + sudo cp -a "$config_file" "$config_file.backup.$(date '+%d.%m.%y_%Hh%M,%Ss')" # Si le fichier de config a été modifié, créer un backup. + fi sudo cp ../conf/config.js "$final_path/infcloud/" sudo sed -i "s@__DOMAIN__@$domain@g" "$final_path/infcloud/config.js" sudo sed -i "s@__PATH__@$path@g" "$final_path/infcloud/config.js"