From 822333690f60cfdbf7859317a36b39657dd27ad6 Mon Sep 17 00:00:00 2001 From: Kali Hernandez Date: Tue, 24 Jan 2017 23:54:19 +0100 Subject: [PATCH] Debian package: check for group before useradd (#2107) Fixes #2106 --- scripts/post-install.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/post-install.sh b/scripts/post-install.sh index 95045be1f..45a19d26c 100644 --- a/scripts/post-install.sh +++ b/scripts/post-install.sh @@ -26,7 +26,12 @@ function install_chkconfig { id telegraf &>/dev/null if [[ $? -ne 0 ]]; then - useradd -r -K USERGROUPS_ENAB=yes -M telegraf -s /bin/false -d /etc/telegraf + grep "^telegraf:" /etc/group &>/dev/null + if [[ $? -ne 0 ]]; then + useradd -r -K USERGROUPS_ENAB=yes -M telegraf -s /bin/false -d /etc/telegraf + else + useradd -r -K USERGROUPS_ENAB=yes -M telegraf -s /bin/false -d /etc/telegraf -g telegraf + fi fi test -d $LOG_DIR || mkdir -p $LOG_DIR