From e7e03e36de561853cd120fca282e3e746918b783 Mon Sep 17 00:00:00 2001 From: bcambl Date: Fri, 12 Oct 2018 11:05:44 -0600 Subject: [PATCH] fix pihole user creation function - fix stdout newlines - catch failed user creation Signed-off-by: bcambl --- automated install/basic-install.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 337a4bfb..b8eb7864 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1633,15 +1633,18 @@ create_pihole_user() { # If the user pihole exists, if id -u pihole &> /dev/null; then # just show a success - echo -ne "${OVER} ${TICK} ${str}" + echo -e "${OVER} ${TICK} ${str}" # Otherwise, else echo -ne "${OVER} ${CROSS} ${str}" local str="Creating user 'pihole'" - echo -ne " ${INFO} ${str}..." + echo -ne "${OVER} ${INFO} ${str}..." # create her with the useradd command - useradd -r -s /usr/sbin/nologin pihole - echo -ne "${OVER} ${TICK} ${str}" + if useradd -r -s /usr/sbin/nologin pihole; then + echo -e "${OVER} ${TICK} ${str}" + else + echo -e "${OVER} ${CROSS} ${str}" + fi fi }