simplify Git section

This commit is contained in:
Jérémy Lecour 2018-09-04 23:10:27 +02:00
parent 05335d7f08
commit 0cde3681a6

View file

@ -67,10 +67,12 @@ LOG_TEXTE=$(echo "${TEXTE}" | sed 's/"/\\\"/g')
echo "${NOW} hostname=\"${HOSTNAME}\" user=\"${SUDO_USER}\" ip=\"${IP}\" begin_date=\"${BEGIN_YEAR} ${BEGIN_DATE}\" message=\"${LOG_TEXTE}\"" >> "${LOGFILE}"
# git commit
if (test -x /usr/bin/git); then
cd /etc/
git add .
GIT_COMMIT=$(git commit -a -m "$LOG_TEXTE" --author="$_USER <$_USER@evolix.net>")
GIT_BIN=$(command -v git)
if test -x "${GIT_BIN}"; then
export GIT_DIR=/etc/.git
${GIT_BIN} add .
${GIT_BIN} commit --all --message "${LOG_TEXTE}" --author="${_USER} <${_USER}@evolix.net>" --quiet
fi
# insert into PG