From 9ea652070c443cc69a5c373cd5267adc02d95fba Mon Sep 17 00:00:00 2001 From: Qindel Date: Fri, 18 Oct 2024 11:21:49 +0000 Subject: [PATCH] refs #981 Adds correctly the config file and adds a apt -get update before install any packages --- installer/ogdhcp_installer.sh | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/installer/ogdhcp_installer.sh b/installer/ogdhcp_installer.sh index e739f30..37d2694 100755 --- a/installer/ogdhcp_installer.sh +++ b/installer/ogdhcp_installer.sh @@ -11,6 +11,12 @@ function globalSetup() { PROGRAMDIR=$(readlink -e "$current_dir") PROGRAMNAME=$(basename "$0") OPENGNSYS_CLIENT_USER="ogdhcp" + current_dir=$(dirname "$0") + PROGRAMDIR=$(readlink -e "$current_dir") + + # Ruta del archivo config_ogdhcp.json proporcionado por el usuario + CONFIG_FILE="$PROGRAMDIR/config_ogdhcp.json" + # Comprobar si se ha descargado el paquete comprimido (REMOTE=0) o sólo el instalador (REMOTE=1). if [ -d "$PROGRAMDIR/../installer" ]; then @@ -85,12 +91,12 @@ function checkDependencies() { ) export DEBIAN_FRONTEND=noninteractive - + apt-get update -y # Comprobar cada dependencia for dep in "${DEPENDENCIES[@]}"; do if ! dpkg -s "$dep" >/dev/null 2>&1; then echoAndLog "$dep is not installed. Installing..." - sudo apt-get install -y --no-install-recommends "$dep" + apt-get install -y --no-install-recommends "$dep" else echoAndLog "$dep is already installed." fi @@ -451,8 +457,6 @@ modify_php_fpm_config() { configure_kea() { - # Ruta del archivo config_ogdhcp.json proporcionado por el usuario - CONFIG_FILE="config_ogdhcp.json" # Verificar si jq está instalado if ! command -v jq &> /dev/null; then @@ -513,6 +517,17 @@ configure_kea() { EOL echo "Se ha generado la configuración mínima de Kea DHCP en $KEA_CONFIG" + # Reiniciar el servicio de Kea DHCP y verificar si se reinicia correctamente + echo "Reiniciando el servicio Kea DHCP..." + sudo systemctl restart kea-dhcp4-server.service + + # Comprobar el estado del servicio Kea DHCP + if systemctl is-active --quiet kea-dhcp4-server.service; then + echo "Kea DHCP reiniciado correctamente." + else + echo "Error al reiniciar Kea DHCP." + exit 1 + fi }