Fix conditional test against useradd so it's compatible with Dash

The test to see which version of `useradd` is installed uses 'bashisms'
that fail on Ubuntu due to the fact that `/bin/sh` is symlinked to Dash,
causing the telegraf account to be created without the `--system` option
ever being passed.

This change amends the syntax so that it's POSIX-compatible and more
portable as a result.
This commit is contained in:
Nick Jones 2015-09-28 13:22:24 +01:00
parent 0ffaafd788
commit cd7468f3be
1 changed files with 1 additions and 1 deletions

View File

@ -149,7 +149,7 @@ ln -sfn $INSTALL_ROOT_DIR/versions/$version/telegraf $INSTALL_ROOT_DIR/telegraf
if ! id telegraf >/dev/null 2>&1; then
useradd --help 2>&1| grep -- --system > /dev/null 2>&1
old_useradd=\$?
if [[ \$old_useradd == 0 ]]
if [ \$old_useradd -eq 0 ]
then
useradd --system -U -M telegraf
else