1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/transmission_ynh.git synced 2024-09-04 01:46:12 +02:00

Incomplete remove and fix restore after remove

This commit is contained in:
Maniack Crudelis 2017-06-16 20:38:31 +02:00
parent a120411238
commit 1f92bf6376
4 changed files with 14 additions and 4 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
*.swp *.swp
*.swo *.swo
*~

View file

@ -52,6 +52,9 @@ ynh_backup "/etc/transmission-daemon/settings.json" "${YNH_APP_BACKUP_DIR}/etc/t
CHECK_SIZE "/usr/share/transmission" CHECK_SIZE "/usr/share/transmission"
ynh_backup "/usr/share/transmission" "${YNH_APP_BACKUP_DIR}/usr/share/transmission" ynh_backup "/usr/share/transmission" "${YNH_APP_BACKUP_DIR}/usr/share/transmission"
CHECK_SIZE "/var/lib/transmission-daemon"
ynh_backup "/var/lib/transmission-daemon" "${YNH_APP_BACKUP_DIR}/var/lib/transmission-daemon"
backup_core_only=$(ynh_app_setting_get $app backup_core_only) backup_core_only=$(ynh_app_setting_get $app backup_core_only)
if [ -z $backup_core_only ] # Si backup_core_only a une valeur dans le fichier settings.yml, ne sauvegarde pas le dossier data if [ -z $backup_core_only ] # Si backup_core_only a une valeur dans le fichier settings.yml, ne sauvegarde pas le dossier data
then then

View file

@ -68,8 +68,10 @@ sudo rm "/home/yunohost.multimedia/share/Torrent to download"
# Remove config # Remove config
ynh_secure_remove /etc/transmission-daemon ynh_secure_remove /etc/transmission-daemon
# And data # Web interface
ynh_secure_remove /usr/share/transmission ynh_secure_remove /usr/share/transmission
# And data
ynh_secure_remove /var/lib/transmission-daemon
#================================================= #=================================================
# GENERIC FINALISATION # GENERIC FINALISATION

View file

@ -69,14 +69,18 @@ ynh_package_install transmission-daemon
# Transmission has to be stopped before modifying its config # Transmission has to be stopped before modifying its config
sudo systemctl stop transmission-daemon sudo systemctl stop transmission-daemon
sudo rm -f /etc/transmission-daemon/settings.json ynh_secure_remove /etc/transmission-daemon/settings.json
ynh_restore_file "/etc/transmission-daemon/settings.json" ynh_restore_file /etc/transmission-daemon/settings.json
#================================================= #=================================================
# RESTORE DATA # RESTORE DATA
#================================================= #=================================================
ynh_restore_file "/usr/share/transmission" ynh_secure_remove /usr/share/transmission
ynh_restore_file /usr/share/transmission
ynh_secure_remove /var/lib/transmission-daemon
ynh_restore_file /var/lib/transmission-daemon
if [ -d "${YNH_APP_BACKUP_DIR}/home/yunohost.transmission" ] # Le dossier data est restauré seulement si il existe. Si le backup a été fait avec l'option backup_core_only, ce dossier n'a pas été sauvegardé. if [ -d "${YNH_APP_BACKUP_DIR}/home/yunohost.transmission" ] # Le dossier data est restauré seulement si il existe. Si le backup a été fait avec l'option backup_core_only, ce dossier n'a pas été sauvegardé.
then then