refs #2270 , backup kea and config files
parent
024569f3a5
commit
1585b7a706
|
@ -35,10 +35,15 @@ OGBOOT_IP="$RET"
|
|||
|
||||
# Get PHP version
|
||||
PHP_VERSION=$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')
|
||||
if [ -z "$PHP_VERSION" ]; then
|
||||
echo "Error: No se pudo determinar la versión de PHP."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
case "$1" in
|
||||
configure)
|
||||
if [ $2 == "" ]; then
|
||||
if [ -z "$2" ]; then
|
||||
echo ">>> Configuración de ogdhcp, realizando instalacion nueva"
|
||||
# Configuración de kea-ctrl-agent
|
||||
echo "Eliminando autenticación de kea-ctrl-agent..."
|
||||
|
@ -51,7 +56,6 @@ case "$1" in
|
|||
}' "$KEA_CTRL_AGENT_CONF"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Configuración de AppArmor
|
||||
APPARMOR_LOCAL_PROFILE="/etc/apparmor.d/local/usr.sbin.kea-dhcp4"
|
||||
echo "Añadiendo permisos personalizados a AppArmor para kea-dhcp4..."
|
||||
|
@ -124,20 +128,22 @@ EOF
|
|||
}
|
||||
}
|
||||
EOF
|
||||
else ; then
|
||||
fi
|
||||
else
|
||||
|
||||
echo "Actualizando configuración de kea-dhcp4..."
|
||||
restore_config_if_modified "/etc/kea/kea-dhcp4.conf"
|
||||
restore_config_if_modified "/etc/kea/kea-ctrl-agent.conf"
|
||||
restore_config_if_modified "/opt/opengnsys/ogdhcp/api/.env"
|
||||
restore_config_if_modified "/etc/nginx/sites-available/ogdhcp.conf"
|
||||
restore_config_if_modified "/etc/php/$PHP_VERSION/fpm/pool.d/
|
||||
restore_config_if_modified "/etc/php/$PHP_VERSION/fpm/pool.d/ogdhcp.conf"
|
||||
fi
|
||||
|
||||
echo "Configuración de kea-dhcp4 completada."
|
||||
echo ">>> Configuración de ogdhcp completada."
|
||||
;;
|
||||
|
||||
abort-upgrade|abort-remove|abort-deconfigure)
|
||||
echo ">>> Abortando la configuración de ogdhcp"
|
||||
echo "No se realizaron cambios en la configuración."
|
||||
exit 0
|
||||
;;
|
||||
|
||||
*)
|
||||
|
@ -154,9 +160,9 @@ chown -R _kea:_kea /etc/kea
|
|||
|
||||
# Reiniciar servicios
|
||||
systemctl daemon-reload
|
||||
systemctl restart nginx
|
||||
systemctl restart kea-dhcp4-server
|
||||
systemctl restart kea-ctrl-agent
|
||||
systemctl restart php$PHP_VERSION-fpm
|
||||
systemctl restart nginx || echo "Error al reiniciar nginx"
|
||||
systemctl restart kea-dhcp4-server || echo "Error al reiniciar kea-dhcp4-server"
|
||||
systemctl restart kea-ctrl-agent || echo "Error al reiniciar kea-ctrl-agent"
|
||||
systemctl restart php$PHP_VERSION-fpm || echo "Error al reiniciar php$PHP_VERSION-fpm"
|
||||
|
||||
exit 0
|
||||
|
|
Loading…
Reference in New Issue