YunoHost-Apps / archivist_ynh

GNU General Public License v3.0
13 stars 4 forks source link

Do not create real backup if temp failed #2

Closed nicofrand closed 6 years ago

nicofrand commented 6 years ago

Hi,

I launched /opt/yunohost/archivist/archivist.sh after removing my Laverna app, and without editing the conf file (yeah, I should have, I simply forgot). I already made a backup with archivist, some weeks ago.

Here is the output:

>> Make a temporary backup for laverna_backup
Error: App 'laverna' will not be saved
Error: There is nothing to save
rm: cannot remove ‘/home/yunohost.app/archivist/backup/ynh_backup/temp/info.json’: No such file or directory
find: `/home/yunohost.app/archivist/backup/ynh_backup/temp': No such file or directory
>>> This backup is different than the previous one
>>>> Make a real backup for laverna_backup
Error: App 'laverna' will not be saved
Error: There is nothing to save
cp: cannot stat ‘/home/yunohost.backup/archives/laverna_backup.tar.gz’: No such file or directory
cp: cannot stat ‘/home/yunohost.backup/archives/laverna_backup.info.json’: No such file or directory
1.7M /home/yunohost.app/archivist/backup/ynh_backup/laverna_backup.tar.gz

If "Make a temporary backup" fails, maybe we should not run "Make a real backup" ?

maniackcrudelis commented 6 years ago

Hi nicofrand,

you're right, it should not make a real backup if it fails the temporary one.

It's here https://github.com/maniackcrudelis/archivist/blob/master/archivist.sh#L311 As soon as I can do that, I will add an if here with a return 1.

nicofrand commented 6 years ago

Thanks !

BTW, I was wondering why "Make a real backup" was not simply doing a cp or mv of the temp backup, to be faster ?

maniackcrudelis commented 6 years ago

Because, the temporary backup is not compressed, and some files are missing. This backup is designed only for performing a checksum of all the files.

maniackcrudelis commented 6 years ago

Fixed here https://github.com/maniackcrudelis/archivist/commit/6a02856d17275beea0f9dd0c757ee95cdd6255cf

I'll upgrade this package with the next upgrade (incoming)

maniackcrudelis commented 6 years ago

Upgraded https://github.com/YunoHost-Apps/archivist_ynh/commit/6ccd8ba2435a7face219e36383409ef40d969a61 Should be ok now.