mirror of
https://github.com/YunoHost-Apps/lutim_ynh.git
synced 2024-09-03 19:36:24 +02:00
Backup config alternative
This commit is contained in:
parent
8a506ff152
commit
6b1a706ca8
2 changed files with 6 additions and 0 deletions
|
@ -123,6 +123,8 @@ fi
|
|||
sudo sed -i "s@__ENCRYPT__@$always_encrypt@g" "$final_path/lutim.conf"
|
||||
secret=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' | sed -n 's/\(.\{24\}\).*/\1/p')
|
||||
sudo sed -i "s@__SECRET__@$secret@g" "$final_path/lutim.conf"
|
||||
sudo yunohost app setting $app lutim.conf_file_md5 -v $(md5sum "$final_path/lutim.conf" | cut -d' ' -f1)
|
||||
|
||||
|
||||
codename=$(lsb_release -a 2>/dev/null | grep Codename | cut -f 2)
|
||||
sudo yunohost app setting $app codename -v $codename
|
||||
|
|
|
@ -39,6 +39,10 @@ sudo sed -i "s@__PATH__@$path@g" /etc/nginx/conf.d/$domain.d/$app.conf
|
|||
sudo sed -i "s@__PORT__@$port@g" /etc/nginx/conf.d/$domain.d/$app.conf
|
||||
|
||||
## Copie et configuration du fichier de conf.
|
||||
config_file="$final_path/lutim.conf"
|
||||
if [ "$(sudo yunohost app setting $app lutim.conf_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/lutim.conf.template "$final_path/lutim.conf"
|
||||
sudo sed -i "s@__DOMAIN__@$domain@g" "$final_path/lutim.conf"
|
||||
sudo sed -i "s@__PATH__@$path@g" "$final_path/lutim.conf"
|
||||
|
|
Loading…
Add table
Reference in a new issue