graysky2 / anything-sync-daemon

Symlinks and syncs user specified dirs to RAM thus reducing HDD/SDD calls and speeding-up the system.
https://wiki.archlinux.org/index.php/Anything-sync-daemon
MIT License
345 stars 45 forks source link

Return non-zero exit code breaks first call of systemd unit #47

Closed JanLuca closed 7 years ago

JanLuca commented 7 years ago

When installing the anything-sync-daemon and run "systemctl start" before adjust asd.conf, the systemd unit returns it is failed. This is caused by the return of a non-zero exit code if no directory to sync is set or the $VOLATILE is not adjusted yet.

This commit sets a zero exit code for this not uncommon cases so the call of the "systemctl start" does not fail but just stop due to the exit command.

This is necessary since so package manager like dpkg can try to start the systemd unit after installation/upgrade and do not fail due to a failure of the systemd unit.

graysky2 commented 7 years ago

I might not understand correctly, but VOLATILE should always be defined. Line 74 does even if the config file does not have a value. If a package manager starts the service when the WHATTOSYNC array is null, it should end in a failure state, no? Why have systemd think that the sync is setup?

I might not be understanding. Please clarify.

JanLuca commented 7 years ago

It is correct that the anything-sync-daemon should exit if WHATTOSYNC is empty. The problem is that the Debian package manager aborts the installation if the systemd service exits with a non-zero-state. The problem is if you disable the auto-start-logic the auto stop-and-restart logic when upgrading the package is disabled, too.

But you are right, this change is more a workaround of the problem, there should be a fix in Debian to allow disable the start-on-first-installation...

graysky2 commented 7 years ago

Agreed. I will close this as it seems like a Debian problem.