1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/radicale_ynh.git synced 2024-09-03 20:16:14 +02:00

Backup config alternative

This commit is contained in:
Maniack Crudelis 2016-06-05 00:52:51 +02:00
parent 2dc3e0760b
commit 4131db1747
2 changed files with 15 additions and 0 deletions

View file

@ -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

View file

@ -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"