Files
docker-django-test/container-filesystem/usr/local/sbin/certbot-set-default.sh
heinzel cd193da78f FIX #1
2019-10-18 16:50:21 +02:00

25 lines
577 B
Bash

#!/bin/sh
LIVE_DIR="/etc/letsencrypt/live"
DEFAULT_LINK="${LIVE_DIR}/default"
CERT_DIR=""
if test "$1" != "" ; then
CERT_DIR="$1"
elif test "$RENEWED_LINEAGE" != "" ; then
CERT_DIR="$RENEWED_LINEAGE"
else
echo "You must name a certificate dir either as argument or via RENEWED_LINEAGE" >&2
exit 64
fi
cert_name=`basename $CERT_DIR`
echo "Setting $cert_name as default certificate name"
if test -L "$DEFAULT_LINK" ; then
rm "$DEFAULT_LINK"
elif test -e "$DEFAULT_LINK" ; then
echo "Not a symbolic link: $DEFAULT_LINK" >&2
exit 78
fi
ln -s "$cert_name" "$DEFAULT_LINK"