postinst: Fix perms only if dir exists

If spamassassin is installed via the debian installer while start-stop-daemon is diverted via dpkg-divert, sa-compile will not have run, so the output dir doesn't exist when the postinst script tries to change its permissions. That causes an error while configuring sa-compile.

Fix that by checking if the dir exists.

This may still mean the permissions aren't set properly after the package has been installed (because dpkg-diverting start-stop-daemon means that sa-compile hasn't been run), but at least the package installs now. If you run sa-compile manually afterwards you can set the permissions correctly afterwards as well.

Closes: #977957

Merge request reports

Loading