Debian package: check for group before useradd (#2107)

Fixes #2106
This commit is contained in:
Kali Hernandez 2017-01-24 23:54:19 +01:00 committed by Cameron Sparr
parent d7a8bb2214
commit 822333690f
1 changed files with 6 additions and 1 deletions

View File

@ -26,7 +26,12 @@ function install_chkconfig {
id telegraf &>/dev/null id telegraf &>/dev/null
if [[ $? -ne 0 ]]; then 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 fi
test -d $LOG_DIR || mkdir -p $LOG_DIR test -d $LOG_DIR || mkdir -p $LOG_DIR