diff --git a/rattail/fablib/certbot.py b/rattail/fablib/certbot.py index 5283de89978f53b340fac0ad5d37b81048302b02..d246a8e7393ed90ae537094f94334928afe7ecfd 100644 --- a/rattail/fablib/certbot.py +++ b/rattail/fablib/certbot.py @@ -32,31 +32,38 @@ from fabric.contrib.files import exists from rattail.fablib import apt, get_debian_version -def install(): +def install(source=False): """ Install the Let's Encrypt certbot utility """ - version = get_debian_version() - - # debian 7 wheezy - if 7 <= version < 8: + if source: if not exists('/usr/local/src/certbot'): with cd('/usr/local/src'): sudo('git clone https://github.com/certbot/certbot') sudo('ln --symbolic --force /usr/local/src/certbot/certbot-auto /usr/local/bin/certbot') - # debian 8 jessie - elif 8 <= version < 9: - apt.add_source('deb http://ftp.debian.org/debian jessie-backports main') - apt.install('python-certbot-apache', target_release='jessie-backports') + else: + version = get_debian_version() - # debian 9 stretch, or later - elif version >= 9: - apt.install('python-certbot-apache') + # debian 7 wheezy + if 7 <= version < 8: + if not exists('/usr/local/src/certbot'): + with cd('/usr/local/src'): + sudo('git clone https://github.com/certbot/certbot') + sudo('ln --symbolic --force /usr/local/src/certbot/certbot-auto /usr/local/bin/certbot') - # other..? will have to investigate when this comes up - else: - abort("don't know how to install certbot on debian version {}".format(version)) + # debian 8 jessie + elif 8 <= version < 9: + apt.add_source('deb http://ftp.debian.org/debian jessie-backports main') + apt.install('python-certbot-apache', target_release='jessie-backports') + + # debian 9 stretch, or later + elif version >= 9: + apt.install('python-certbot-apache') + + # other..? will have to investigate when this comes up + else: + abort("don't know how to install certbot on debian version {}".format(version)) def certonly(*domains):