Adapted from Debian equivs package