fixed issue when user where already exist
This commit is contained in:
@@ -86,10 +86,19 @@ function backtrace
|
|||||||
# Execute command outside of error control, echoes ouput error code
|
# Execute command outside of error control, echoes ouput error code
|
||||||
noerror()
|
noerror()
|
||||||
{
|
{
|
||||||
|
if [[ $1 == "--noout" ]]; then
|
||||||
|
local noout=true
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
set +o errexit
|
set +o errexit
|
||||||
trap - ERR
|
trap - ERR
|
||||||
|
|
||||||
$@
|
if [[ -n $noout ]]; then
|
||||||
|
$@ > /dev/null 2>&1
|
||||||
|
else
|
||||||
|
$@
|
||||||
|
fi
|
||||||
local code=$?
|
local code=$?
|
||||||
|
|
||||||
trap "error ${LINENO}" ERR
|
trap "error ${LINENO}" ERR
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
# * LOCAL_USERS: List of local users to create
|
# * LOCAL_USERS: List of local users to create
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
export VER_authnz=0.1.1
|
export VER_authnz=0.1.2
|
||||||
|
|
||||||
# Users (from Ldap)
|
# Users (from Ldap)
|
||||||
add_remote_user()
|
add_remote_user()
|
||||||
@@ -27,7 +27,11 @@ add_remote_user()
|
|||||||
# Create a local user
|
# Create a local user
|
||||||
create_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
|
# Authentication
|
||||||
|
|||||||
Reference in New Issue
Block a user