From cd7468f3be4c8031d8ab62c069194985fa8aa57f Mon Sep 17 00:00:00 2001 From: Nick Jones Date: Mon, 28 Sep 2015 13:22:24 +0100 Subject: [PATCH] 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. --- scripts/package.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/package.sh b/scripts/package.sh index ace553e57..e88e52f9e 100755 --- a/scripts/package.sh +++ b/scripts/package.sh @@ -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