#!/bin/sh

if [ "$1" = "-T" ]; then
	echo -n "(c) ISPsystem.com"
	exit 0
fi

DOMAIN=${1}

. /usr/local/mgr5/lib/pkgsh/core_pkg_funcs.sh

Infon "Let's encrypt certificate... "
${MGRCTL} ihttpd.certs.edit domain="${DOMAIN}" type=letsencrypt sok=ok >/dev/null 2>&1
errexit=$?
if [ "${errexit}" -ne 0 ]; then
	Error "Failed. For more information see ${MGRDIR}/var/core.log"
else
	Info "OK"
fi
exit ${errexit}
