mirror of
https://git.freebsd.org/ports.git
synced 2025-05-31 18:36:28 -04:00
Lego is a new let's encrypt client write in Go with support for number of ACME challenges and no external dependencies. PR: 237349 Submitted by: Matthew Horan <matt@matthoran.com>
40 lines
820 B
Bash
40 lines
820 B
Bash
#!/bin/sh -e
|
|
|
|
# Email used for registration and recovery contact.
|
|
EMAIL=""
|
|
|
|
BASEDIR="%%ETCDIR%%"
|
|
SSLDIR="%%PREFIX%%/etc/ssl/lego"
|
|
DOMAINSFILE="${BASEDIR}/domains.txt"
|
|
|
|
if [ -z "${EMAIL}" ]; then
|
|
echo "Please set EMAIL to a valid address in ${BASEDIR}/lego.sh"
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -e "${DOMAINSFILE}" ]; then
|
|
echo "Please create ${DOMAINSFILE} as specified in ${BASEDIR}/lego.sh"
|
|
exit 1
|
|
fi
|
|
|
|
if [ "$1" = "run" ]; then
|
|
command="run"
|
|
else
|
|
command="renew --days 30"
|
|
fi
|
|
|
|
run_or_renew() {
|
|
%%PREFIX%%/bin/lego --path "${SSLDIR}" \
|
|
--email="${EMAIL}" \
|
|
$(printf -- "--domains=%s " $line) \
|
|
--http --http.webroot="%%WWWDIR%%" \
|
|
$1
|
|
}
|
|
|
|
while read line <&3; do
|
|
if [ "$command" = "run" ]; then
|
|
run_or_renew "$command"
|
|
else
|
|
output=$(run_or_renew "$command") || (echo "$output" && exit 1)
|
|
fi
|
|
done 3<"${DOMAINSFILE}"
|