25 lines
577 B
Bash
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"
|