fixed issue when user where already exist

This commit is contained in:
levasseur
2021-09-13 14:26:40 +02:00
parent bdac33284e
commit a06897270f
2 changed files with 16 additions and 3 deletions

View File

@@ -86,10 +86,19 @@ function backtrace
# Execute command outside of error control, echoes ouput error code
noerror()
{
if [[ $1 == "--noout" ]]; then
local noout=true
shift
fi
set +o errexit
trap - ERR
$@
if [[ -n $noout ]]; then
$@ > /dev/null 2>&1
else
$@
fi
local code=$?
trap "error ${LINENO}" ERR

View File

@@ -13,7 +13,7 @@
# * LOCAL_USERS: List of local users to create
# ------------------------------------------------------------------------------
export VER_authnz=0.1.1
export VER_authnz=0.1.2
# Users (from Ldap)
add_remote_user()
@@ -27,7 +27,11 @@ add_remote_user()
# Create a local user
create_user()
{
useradd -Um $1
if [[ $(noerror --noouut id $1) != 0 ]]; then
useradd -Um $1
else
prnt W "L'utilisateur $1 existe déjà. Rien à faire..."
fi
}
# Authentication