diff --git a/installer/ogdhcp_installer.sh b/installer/ogdhcp_installer.sh index 7d71df0..5c20840 100755 --- a/installer/ogdhcp_installer.sh +++ b/installer/ogdhcp_installer.sh @@ -76,22 +76,21 @@ function checkDependencies() { php-bcmath composer unzip - apache2 - libapache2-mod-php kea-dhcp4-server kea-common kea-ctrl-agent jq net-tools - composer + nginx ) + export DEBIAN_FRONTEND=noninteractive # 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 "$dep" + sudo apt-get install -y --no-install-recommends "$dep" else echoAndLog "$dep is already installed." fi @@ -176,7 +175,7 @@ function createDirs() { function create_ogdhcp_project { # Cambia al usuario ogdhcp y crea el proyecto Symfony local path_opengnsys_base="$1" - composer create-project symfony/website-skeleton "$path_opengnsys_base" + sudo -u ogboot composer create-project symfony/website-skeleton "$path_opengnsys_base" pushd "$path_opengnsys_base" || return # Elimina el archivo composer.lock rm composer.lock @@ -199,9 +198,6 @@ function copyServerFiles() { #public src etc - templates - tests - vendor .env composer.json composer.lock @@ -213,9 +209,6 @@ function copyServerFiles() { #public src etc - templates - tests - vendor .env composer.json composer.lock @@ -250,53 +243,12 @@ function copyServerFiles() { popd || return } -function downloadComposer() { - echoAndLog "Downloading composer.phar..." - - # Crear el directorio de trabajo si no existe - mkdir -p "$WORKDIR/ogdhcp/bin" || return - - # Cambiar al directorio de trabajo - pushd "$WORKDIR/ogdhcp/bin" || return - - # Descargar composer.phar - curl -sS https://getcomposer.org/installer | php - - # Comprobar si la descarga fue exitosa - if [ ! -f composer.phar ]; then - errorAndLog "Failed to download composer.phar" - popd - return 1 - fi - - # Crear el directorio de destino si no existe - mkdir -p "/opt/ogdhcp/bin" || return - - # Mover composer.phar a /opt/ogdhcp/bin - mv composer.phar "/opt/ogdhcp/bin/" - - # Comprobar si el movimiento fue exitoso - if [ ! -f "/opt/ogdhcp/bin/composer.phar" ]; then - errorAndLog "Failed to move composer.phar to /opt/ogdhcp/bin" - popd - return 1 - fi - - # Volver al directorio original - popd || return - - echoAndLog "composer.phar downloaded and moved to /opt/ogdhcp/bin" - return 0 -} function runComposer() { echoAndLog "Running composer.phar to install dependencies..." - # Cambiar al directorio donde está composer.phar - pushd /opt/ogdhcp/bin || return - # Ejecutar composer.phar - sudo -u "$OPENGNSYS_CLIENT_USER" php composer.phar install + sudo -u "$OPENGNSYS_CLIENT_USER" composer install # Comprobar si la ejecución fue exitosa if [ $? -ne 0 ]; then @@ -305,8 +257,6 @@ function runComposer() { return 1 fi - # Volver al directorio original - popd || return echoAndLog "composer.phar ran successfully and dependencies were installed" return 0 @@ -538,7 +488,6 @@ if [ $? -ne 0 ]; then exit 1 fi -downloadComposer runComposer # Creando configuración de Apache.