refs #1468 changes home of the opengnsys user
testing/og-dhcp-API/pipeline/head There was a failure building this commit
Details
testing/og-dhcp-API/pipeline/head There was a failure building this commit
Details
parent
05c050736e
commit
1dbccabe4e
|
@ -147,14 +147,27 @@ function createDirs() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
# Crear usuario ficticio.
|
||||
# Verificar si el usuario OPENGNSYS_CLIENT_USER existe
|
||||
if id -u "$OPENGNSYS_CLIENT_USER" &>/dev/null; then
|
||||
echoAndLog "${FUNCNAME}(): user \"$OPENGNSYS_CLIENT_USER\" is already created"
|
||||
# Salida de getent passwd -> opengnsys:x:1001:1001::/opt/opengnsys:/bin/sh
|
||||
CURRENT_HOME=$(getent passwd "$OPENGNSYS_CLIENT_USER" | cut -d: -f6)
|
||||
echoAndLog "${FUNCNAME[0]}(): user \"$OPENGNSYS_CLIENT_USER\" already exists with home \"$CURRENT_HOME\""
|
||||
|
||||
# Si el home no es correcto, cambiarlo
|
||||
if [ "$CURRENT_HOME" != "/opt/opengnsys" ]; then
|
||||
echoAndLog "${FUNCNAME[0]}(): updating home directory for \"$OPENGNSYS_CLIENT_USER\" to \"/opt/opengnsys\""
|
||||
usermod -d "/opt/opengnsys" -m "$OPENGNSYS_CLIENT_USER"
|
||||
if [ $? -ne 0 ]; then
|
||||
errorAndLog "${FUNCNAME[0]}(): error updating home for \"$OPENGNSYS_CLIENT_USER\""
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echoAndLog "${FUNCNAME}(): creating OpenGnsys user"
|
||||
useradd "$OPENGNSYS_CLIENT_USER" 2>/dev/null
|
||||
# Crear usuario si no existe
|
||||
echoAndLog "${FUNCNAME[0]}(): creating OpenGnsys user \"$OPENGNSYS_CLIENT_USER\""
|
||||
useradd --create-home -d "/opt/opengnsys" --shell "/bin/bash" "$OPENGNSYS_CLIENT_USER"
|
||||
if [ $? -ne 0 ]; then
|
||||
errorAndLog "${FUNCNAME}(): error creating OpenGnsys user"
|
||||
errorAndLog "${FUNCNAME[0]}(): error creating user \"$OPENGNSYS_CLIENT_USER\""
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
@ -162,13 +175,13 @@ function createDirs() {
|
|||
# Mover el fichero de registro de instalación al directorio de logs.
|
||||
echoAndLog "${FUNCNAME}(): moving installation log file"
|
||||
mv "$LOG_FILE" "$path_opengnsys_base/var/log" && LOG_FILE="$OGLOGFILE"
|
||||
chmod 777 "$LOG_FILE"
|
||||
sudo chmod -R 777 "$path_opengnsys_base/etc"
|
||||
chmod 644 "$LOG_FILE"
|
||||
chmod -R 644 "$path_opengnsys_base/etc"
|
||||
|
||||
# Mover el fichero de registro de instalación al directorio de logs.
|
||||
echoAndLog "${FUNCNAME}(): moving installation log file"
|
||||
touch "$path_opengnsys_base/var/log/dev.log"
|
||||
chmod 777 "$path_opengnsys_base/var/log/dev.log"
|
||||
chmod 644 "$path_opengnsys_base/var/log/dev.log"
|
||||
|
||||
echoAndLog "${FUNCNAME}(): directory paths created"
|
||||
return 0
|
||||
|
|
Loading…
Reference in New Issue