refs #799 fix composer error and deletes download composer.phar function
testing/og-dhcp-API/pipeline/head This commit looks good
Details
testing/og-dhcp-API/pipeline/head This commit looks good
Details
parent
d844185d89
commit
2c4160e629
|
@ -76,22 +76,21 @@ function checkDependencies() {
|
||||||
php-bcmath
|
php-bcmath
|
||||||
composer
|
composer
|
||||||
unzip
|
unzip
|
||||||
apache2
|
|
||||||
libapache2-mod-php
|
|
||||||
kea-dhcp4-server
|
kea-dhcp4-server
|
||||||
kea-common
|
kea-common
|
||||||
kea-ctrl-agent
|
kea-ctrl-agent
|
||||||
jq
|
jq
|
||||||
net-tools
|
net-tools
|
||||||
composer
|
nginx
|
||||||
|
|
||||||
)
|
)
|
||||||
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
# Comprobar cada dependencia
|
# Comprobar cada dependencia
|
||||||
for dep in "${DEPENDENCIES[@]}"; do
|
for dep in "${DEPENDENCIES[@]}"; do
|
||||||
if ! dpkg -s "$dep" >/dev/null 2>&1; then
|
if ! dpkg -s "$dep" >/dev/null 2>&1; then
|
||||||
echoAndLog "$dep is not installed. Installing..."
|
echoAndLog "$dep is not installed. Installing..."
|
||||||
sudo apt-get install -y "$dep"
|
sudo apt-get install -y --no-install-recommends "$dep"
|
||||||
else
|
else
|
||||||
echoAndLog "$dep is already installed."
|
echoAndLog "$dep is already installed."
|
||||||
fi
|
fi
|
||||||
|
@ -176,7 +175,7 @@ function createDirs() {
|
||||||
function create_ogdhcp_project {
|
function create_ogdhcp_project {
|
||||||
# Cambia al usuario ogdhcp y crea el proyecto Symfony
|
# Cambia al usuario ogdhcp y crea el proyecto Symfony
|
||||||
local path_opengnsys_base="$1"
|
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
|
pushd "$path_opengnsys_base" || return
|
||||||
# Elimina el archivo composer.lock
|
# Elimina el archivo composer.lock
|
||||||
rm composer.lock
|
rm composer.lock
|
||||||
|
@ -199,9 +198,6 @@ function copyServerFiles() {
|
||||||
#public
|
#public
|
||||||
src
|
src
|
||||||
etc
|
etc
|
||||||
templates
|
|
||||||
tests
|
|
||||||
vendor
|
|
||||||
.env
|
.env
|
||||||
composer.json
|
composer.json
|
||||||
composer.lock
|
composer.lock
|
||||||
|
@ -213,9 +209,6 @@ function copyServerFiles() {
|
||||||
#public
|
#public
|
||||||
src
|
src
|
||||||
etc
|
etc
|
||||||
templates
|
|
||||||
tests
|
|
||||||
vendor
|
|
||||||
.env
|
.env
|
||||||
composer.json
|
composer.json
|
||||||
composer.lock
|
composer.lock
|
||||||
|
@ -250,53 +243,12 @@ function copyServerFiles() {
|
||||||
popd || return
|
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() {
|
function runComposer() {
|
||||||
echoAndLog "Running composer.phar to install dependencies..."
|
echoAndLog "Running composer.phar to install dependencies..."
|
||||||
|
|
||||||
# Cambiar al directorio donde está composer.phar
|
|
||||||
pushd /opt/ogdhcp/bin || return
|
|
||||||
|
|
||||||
# Ejecutar composer.phar
|
# 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
|
# Comprobar si la ejecución fue exitosa
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
|
@ -305,8 +257,6 @@ function runComposer() {
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Volver al directorio original
|
|
||||||
popd || return
|
|
||||||
|
|
||||||
echoAndLog "composer.phar ran successfully and dependencies were installed"
|
echoAndLog "composer.phar ran successfully and dependencies were installed"
|
||||||
return 0
|
return 0
|
||||||
|
@ -538,7 +488,6 @@ if [ $? -ne 0 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
downloadComposer
|
|
||||||
|
|
||||||
runComposer
|
runComposer
|
||||||
# Creando configuración de Apache.
|
# Creando configuración de Apache.
|
||||||
|
|
Loading…
Reference in New Issue