From 7f7bc0a53788b49ae43ea7808eabd26c0e780841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Rodr=C3=ADguez?= Date: Tue, 29 Nov 2022 13:00:26 +0100 Subject: [PATCH] Merge pull request #1956 from wazuh/user-error-solaris Fix error when creating user in Solaris 10 --- solaris/solaris10/postremove.sh | 4 ++-- solaris/solaris10/preinstall.sh | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/solaris/solaris10/postremove.sh b/solaris/solaris10/postremove.sh index 0ce350c735..409142bd75 100755 --- a/solaris/solaris10/postremove.sh +++ b/solaris/solaris10/postremove.sh @@ -2,10 +2,10 @@ # postremove script for wazuh-agent # Wazuh, Inc 2015 -if getent passwd wazuh; then +if getent passwd wazuh > /dev/null 2>&1; then userdel wazuh fi -if getent group wazuh; then +if getent group wazuh > /dev/null 2>&1; then groupdel wazuh fi diff --git a/solaris/solaris10/preinstall.sh b/solaris/solaris10/preinstall.sh index 9b5e7d17f0..8fd757feec 100755 --- a/solaris/solaris10/preinstall.sh +++ b/solaris/solaris10/preinstall.sh @@ -34,13 +34,13 @@ if [ ! -f ${OSMYSHELL} ]; then fi fi -getent group | grep "^wazuh" -if [ "$?" -eq 1 ]; then +getent group wazuh > /dev/null 2>&1 +if [ "$?" -ne 0 ]; then groupadd ${GROUP} fi -getent passwd wazuh -if [ "$?" -eq 1 ]; then +getent passwd wazuh > /dev/null 2>&1 +if [ "$?" -ne 0 ]; then useradd -d ${DIR} -s ${OSMYSHELL} -g ${GROUP} ${USER} > /dev/null 2>&1 fi