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 8 insertions and 1 deletions:
0 comments (0 inline, 0 general)
rattail/fablib/certbot.py
Show inline comments
 
@@ -11,52 +11,59 @@
 
#  Foundation, either version 3 of the License, or (at your option) any later
 
#  version.
 
#
 
#  Rattail is distributed in the hope that it will be useful, but WITHOUT ANY
 
#  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
#  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 
#  details.
 
#
 
#  You should have received a copy of the GNU General Public License along with
 
#  Rattail.  If not, see <http://www.gnu.org/licenses/>.
 
#
 
################################################################################
 
"""
 
Fabric library for Let's Encrypt certbot
 
"""
 

	
 
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
 
    """
 
    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')
 

	
 
    else:
 
        version = get_debian_version()
 

	
 
        # 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')
 

	
 
        # 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):
0 comments (0 inline, 0 general)