|  | @@ -57,7 +57,6 @@ NODH=
 | 
	
		
			
			| 57 | 57 |  DH_KEYLENGTH=2048
 | 
	
		
			
			| 58 | 58 |  INSTALL_DIR=/root/build
 | 
	
		
			
			| 59 | 59 |  LETSENCRYPT_SERVER='https://acme-v01.api.letsencrypt.org/directory'
 | 
	
		
			
			| 60 |  | -LETSENCRYPT_REPO="https://github.com/certbot/certbot"
 | 
	
		
			
			| 61 | 60 |  MY_EMAIL_ADDRESS=
 | 
	
		
			
			| 62 | 61 |  FRIENDS_MIRRORS_SERVER=
 | 
	
		
			
			| 63 | 62 |  FRIENDS_MIRRORS_PASSWORD=
 | 
	
	
		
			
			|  | @@ -196,27 +195,18 @@ function add_cert_letsencrypt {
 | 
	
		
			
			| 196 | 195 |          fi
 | 
	
		
			
			| 197 | 196 |      fi
 | 
	
		
			
			| 198 | 197 |  
 | 
	
		
			
			| 199 |  | -    if [ ! -d $INSTALL_DIR ]; then
 | 
	
		
			
			| 200 |  | -        mkdir -p $INSTALL_DIR
 | 
	
		
			
			| 201 |  | -    fi
 | 
	
		
			
			| 202 |  | -    cd $INSTALL_DIR
 | 
	
		
			
			| 203 |  | -
 | 
	
		
			
			| 204 |  | -    # obtain the repo
 | 
	
		
			
			| 205 |  | -    if [ ! -d ${INSTALL_DIR}/letsencrypt ]; then
 | 
	
		
			
			| 206 |  | -        git_clone $LETSENCRYPT_REPO ${INSTALL_DIR}/letsencrypt
 | 
	
		
			
			| 207 |  | -        if [ ! -d ${INSTALL_DIR}/letsencrypt ]; then
 | 
	
		
			
			| 208 |  | -            exit 76283
 | 
	
		
			
			|  | 198 | +    if [ ! -f /usr/bin/certbot ]; then
 | 
	
		
			
			|  | 199 | +        apt-get -y install certbot -t jessie-backports
 | 
	
		
			
			|  | 200 | +        if [ ! -f /usr/bin/certbot ]; then
 | 
	
		
			
			|  | 201 | +            echo $'LetsEncrypt certbot failed to install'
 | 
	
		
			
			|  | 202 | +            exit 762830
 | 
	
		
			
			| 209 | 203 |          fi
 | 
	
		
			
			| 210 |  | -    else
 | 
	
		
			
			| 211 |  | -        cd ${INSTALL_DIR}/letsencrypt
 | 
	
		
			
			| 212 |  | -        git_pull $LETSENCRYPT_REPO
 | 
	
		
			
			| 213 | 204 |      fi
 | 
	
		
			
			| 214 | 205 |  
 | 
	
		
			
			| 215 | 206 |      # stop the web server
 | 
	
		
			
			| 216 | 207 |      systemctl stop nginx
 | 
	
		
			
			| 217 | 208 |  
 | 
	
		
			
			| 218 |  | -    cd ${INSTALL_DIR}/letsencrypt
 | 
	
		
			
			| 219 |  | -    ./letsencrypt-auto certonly --server $LETSENCRYPT_SERVER --standalone -d $LETSENCRYPT_HOSTNAME --renew-by-default --agree-tos --email $MY_EMAIL_ADDRESS
 | 
	
		
			
			|  | 209 | +    certbot certonly --server $LETSENCRYPT_SERVER --standalone -d $LETSENCRYPT_HOSTNAME --renew-by-default --agree-tos --email $MY_EMAIL_ADDRESS
 | 
	
		
			
			| 220 | 210 |      if [ ! "$?" = "0" ]; then
 | 
	
		
			
			| 221 | 211 |          echo $"Failed to install letsencrypt for domain $LETSENCRYPT_HOSTNAME"
 | 
	
		
			
			| 222 | 212 |          systemctl start nginx
 |