forked from evolix/ansible-roles
19 lines
627 B
Bash
19 lines
627 B
Bash
#!/bin/sh
|
|
|
|
git_bin=$(command -v git)
|
|
letsencrypt_dir=/etc/letsencrypt
|
|
export GIT_DIR="/etc/.git"
|
|
export GIT_WORK_TREE="/etc"
|
|
|
|
if test -x "${git_bin}" && test -d "${GIT_DIR}" && test -d "${GIT_WORK_TREE}"; then
|
|
changed_lines=$(${git_bin} status --porcelain -- ${letsencrypt_dir} | wc -l | tr -d ' ')
|
|
|
|
if [ "${changed_lines}" != "0" ]; then
|
|
${git_bin} add --all ${letsencrypt_dir}
|
|
message="[letsencrypt] certificates renewal (${RENEWED_DOMAINS})"
|
|
${git_bin} commit --message "${message}" --quiet
|
|
else
|
|
echo "Weird, nothing has changed but the hook has been executed for '${RENEWED_DOMAINS}'"
|
|
fi
|
|
fi
|