Changeset - 34306a93f85e
[Not reviewed]
0 1 0
Lance Edgar (lance) - 7 years ago 2018-01-15 14:48:18
lance@edbob.org
Allow certbot to be installed from source, even if package is available
1 file changed with 22 insertions and 15 deletions:
0 comments (0 inline, 0 general)
rattail/fablib/certbot.py
Show inline comments
 
@@ -29,37 +29,44 @@ from __future__ import unicode_literals, absolute_import
 
from fabric.api import sudo, cd, abort
 
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):
 
    """
 
    Obtain SSL certificates
 
    """
0 comments (0 inline, 0 general)