Skip to content

Commit

Permalink
Fix conditional test against useradd so it's compatible with Dash
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
yankcrime committed Sep 28, 2015
1 parent 0ffaafd commit ee52cbc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 = 0 ]
then
useradd --system -U -M telegraf
else
Expand Down

0 comments on commit ee52cbc

Please sign in to comment.