This will avoid symlinking issues and race conditions which leave the
directory in inconsistent state. The change was inspired by the
implementation of @ThibaultLemaire with some minor tweaks to keep the
backup functionality intact. Directories with hardlinks aren't supported
anymore to keep the backup functionality intact
Co-authored-by: Thibault Lemaire <thibault.lemaire@zoho.eu>
This change won't preserve the hardlinks anymore right now, but will
allow the backups to be much faster and space efficient.
Also, this change maintains two states now, one directory refers to the
directory before running asd and the other directory keeps track of the
directory after running asd
If a proper unsync happens. The new directory will be moved atomically
to the place where the original directory existed, if not, the previous
directory will be backed up in tar.zstd format and the updated directory
will be moved back to the place of original directory ( since this
directory might have suffered syncing issues, backup is formed from the
old directory)
asd.conf is needed by the main script in order to run, so it
would be better to install them togheter, improving installation
for users who are not using systemd nor upstart.