Adapted from Debian equivs