This module provides tools to manage Debian/Ubuntu packages and repositories.
See also
Install one or more packages.
If update is True, the package definitions will be updated first, using update_index().
Extra options may be passed to apt-get if necessary.
Example:
import fabtools
# Update index, then install a single package
fabtools.deb.install('build-essential', update=True)
# Install multiple packages
fabtools.deb.install([
'python-dev',
'libxml2-dev',
])
Remove one or more packages.
If purge is True, the package configuration files will be removed from the system.
Extra options may be passed to apt-get if necessary.
Enable unattended package installation by preseeding debconf parameters.
Example:
import fabtools
# Unattended install of Postfix mail server
fabtools.deb.preseed_package('postfix', {
'postfix/main_mailer_type': ('select', 'Internet Site'),
'postfix/mailname': ('string', 'example.com'),
'postfix/destinations': ('string', 'example.com, localhost.localdomain, localhost'),
})
fabtools.deb.install('postfix')
Get the state of dkpg selections.
Returns a dict with state => [packages].
Get the codename of the distrib.
Example:
from fabtools.deb import distrib_codename
if distrib_codename() == 'precise':
print('Ubuntu 12.04 LTS')
Trust packages signed with this public key.
Example:
import fabtools
# Download 3rd party APT public key
if not fabtools.is_file('rabbitmq-signing-key-public.asc'):
run('wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc')
# Tell APT to trust that key
fabtools.deb.add_apt_key('rabbitmq-signing-key-public.asc')