Re: sSMTP and other MTAs
Hugo Haas <firstname.lastname@example.org> writes:
> I made a few tests with update-alternatives. dpkg has no problem replacing
> an alternative symlink by a real file when installing another MTA package.
> (for instance, the /usr/sbin/sendmail symlink will be replaced by the
> sendmail program from Sendmail package).
> However, when the MTA package is removed, the symlinks aren't restored. We
> need to call manually update-alternatives --auto (I don't think it would
> be sensible to ask all MTA maintainers to use alternative just for the
> sSMTP package). Therefore, /usr/sbin/sendmail won't exist anymore, and the
> user is not warned by dpkg about this.
> Would it be a clean way to use a configuration script, ssmtpconfig say,
> which would ask if ssmtp should be used as a sendmail (update-alternatives
> --install) or not (update-alternatives --remove)? Well, if the user
> installs and then removes another MTA, he will have to rerun the script,
> but I don't see any other solution...
Well, ask at install time in the postinst script. Then in the postrm
script, check the file system state (i.e., if sendmail is diverted and
nothing is at /usr/sbin/sendmail) and restore it reasonable like
before the package was installed. You'd have to be careful in the
postinst/postrm scripts to make sure that you don't have
divert/undivert at the wrong times (i.e., error-unroll, upgrade, etc
etc). Cf the maintainer script skeletons that were posted here
.....A. P. Harris...apharris@onShore.com...<URL:http://www.onShore.com/>
To UNSUBSCRIBE, email to email@example.com
with a subject of "unsubscribe". Trouble? Contact firstname.lastname@example.org