Rebuild mail-notification to support SSL under Ubuntu/Debian

Because of a four-year-old disagreement on the legal interpretation of the GPL and OpenSSL licenses, Debian is shipping a neutered and useless version of mail-notification without SSL support. Ubuntu hasn’t resolved the issue, so they’re shipping the same broken package too. People arguing about why they can’t fix bugs bores me. So here is a script to download the source packages, and rebuild them with SSL enabled. It even bumps the version number so that the package manager doesn’t try to overwrite your working package with the broken one in the repository. It also keeps track of the (on my system) thirty-seven megabytes of build dependency packages that it installs and removes them once the package is installed.

# This script rebuilds the mail-notification package with
# --disable-ssl REMOVED so that mail-notification is ACTUALLY USEFUL.
if ls mail-notification* > /dev/null ; then
  echo "This script will execute `rm mail-notification*` when it completes,"
  echo "but there are mail-notification files in this directory already."
  echo "Please remove stale mail-notification package files and re-run this script."
# Remember uninstalled build dependencies
BUILDDEPS=`apt-get build-dep mail-notification -s | grep "^  "`
# Get build dependencies
sudo apt-get -y build-dep mail-notification
# Get packages required to compile with SSL support
sudo aptitude install libssl-dev fakeroot
# Get package source
apt-get source mail-notification
# Get into the directory
cd mail-notification*/
perl -i.bak -pe "s/ssl=no//" debian/rules
# Update the version so that the package manager doesn't get its knickers in a twist
DEBEMAIL="" dch -i "removing line noise which prevented SSL support from being enabled."
# Build package
dpkg-buildpackage -uc -us -rfakeroot
# Remove previously uninstalled build dependencies
sudo aptitude remove $BUILDDEPS
# Checking...
if ! ldd src/mail-notification | grep libssl ; then
    echo "******** SOMETHING WENT WRONG! libssl support NOT ENABLED ********"
# Get out!
cd ..
# Install the living daylights out of the package
sudo dpkg -i mail-notification*.deb
# Clean up package rebuilding debris
rm -fr mail-notification*

Thanks to Jean-Yves Lefort for such a cool little app, and thanks to debian-legal for helping me improve my shell hackery skills!

Update 2008-09-08: Slight improvements to the script. Thanks to brainsik and James Andrewartha for pointing out the -i flag to dch, and to James for pointing out that Fedora, at least, is planning to address these issues.

Update 2010-01-28: Moshe Yudkowsky (and others) point out that the the flags have changed, and that there may also be problems with the build process in newer versions of Ubuntu. I don’t post untested code and I don’t have an Ubuntu machine to test with anymore, so the best I can do is warn you that this script might be totally out of date.

2 thoughts on “Rebuild mail-notification to support SSL under Ubuntu/Debian

  1. Pingback: Mail-Notification with enabled SSL « Tux’s idyllic life.

  2. Pingback: Mail notification with SSL on Ubuntu « Rainer's Blog

Comments are closed.