diff --git a/builder.sh b/builder.sh index ebc7abc..364c250 100755 --- a/builder.sh +++ b/builder.sh @@ -82,6 +82,8 @@ cp component-installer.sh $UBUNTU_CHROOT_DIR/opengnsys-installer/ chmod +x $UBUNTU_CHROOT_DIR/opengnsys-installer/component-installer.sh cp provision_ogcore.sh $UBUNTU_CHROOT_DIR/opengnsys-installer/ chmod +x $UBUNTU_CHROOT_DIR/opengnsys-installer/provision_ogcore.sh +cp provision_oggui.sh $UBUNTU_CHROOT_DIR/opengnsys-installer/ +chmod +x $UBUNTU_CHROOT_DIR/opengnsys-installer/provision_oggui.sh cp pat.txt $UBUNTU_CHROOT_DIR/opengnsys-installer/ @@ -104,7 +106,7 @@ mksquashfs $UBUNTU_CHROOT_DIR $IMAGE_DIR/casper/filesystem.ubuntu.sqfs \ -comp xz -b 1M -Xdict-size 100% \ -e "var/cache/apt/archives/*" -e "root/*" -e "root/.*" -e "tmp/*" -e "tmp/.*" -e "swapfile" -# Create ISO image +# Create ISO imageq cd $IMAGE_DIR && \ xorriso \ -as mkisofs \ diff --git a/component-installer.sh b/component-installer.sh index 5e0535b..7cb7128 100644 --- a/component-installer.sh +++ b/component-installer.sh @@ -27,9 +27,9 @@ Requires=docker.service [Service] WorkingDirectory=/opt/opengnsys/ogCore/repo/ -ExecStart=/usr/bin/docker compose -f docker-compose-deploy.yml up +ExecStart=/usr/bin/docker compose -f /opt/opengnsys/ogCore/etc/docker-compose-deploy.yml up ExecStartPost=/opengnsys-installer/provision_ogcore.sh -ExecStop=/usr/bin/docker compose -f docker-compose-deploy.yml stop +ExecStop=/usr/bin/docker compose -f /opt/opengnsys/ogCore/etc/docker-compose-deploy.yml stop Restart=always [Install] diff --git a/provision_ogcore.sh b/provision_ogcore.sh index b1d430d..d693399 100644 --- a/provision_ogcore.sh +++ b/provision_ogcore.sh @@ -1,8 +1,10 @@ #!/bin/bash +# +set -x cd /opt/opengnsys/ogCore/repo/ -# Preparar el fichero .yaml +# Preparar el fichero .yaml CONF_DIR=/opt/opengnsys/ogCore/etc/ mkdir -p $CONF_DIR @@ -34,9 +36,9 @@ bearer=$(curl -k -X 'POST' 'https://localhost:8443/auth/login' -H 'accept: a if [ $adminuser == "ogadmin" ]; then echo "Cambiando password a ogadmin no puede ser el usuario administrador" - ogadmin_uuid=$(curl -q -k -L https://localhost:8443/users/?username=ogadmin -H 'accept: application/json' -H "Authorization: Bearer $bearer" | jq .[0].uuid | sed 's/"//g') - curl -k -L -X 'PUT' --location "https://localhost:8443/users/$ogadmin_uuid/reset-password" --header 'Content-Type: application/json' --header "Authorization : Bearer $bearer" --data "{ \"currentPassword\": \"12345678\" , \"newPassword\": \"$adminpass\" , \"repeatNewPassword\": \"$adminpass\" }" - exit 0 + ogadmin_uuid=$(curl -q -k -L https://localhost:8443/users/?username=ogadmin -H 'accept: application/json' -H "Authorization: Bearer $bearer" | jq .[0].uuid | sed 's/"//g') + curl -k -L -X PUT "https://localhost:8443/users/$ogadmin_uuid/reset-password" -H 'accept: application/ld+json' -H 'Content-Type: application/ld+json' -d "{\"currentPassword\": \"12345678\", \"newPassword\": \"$adminpass\", \"repeatNewPassword\": \"$adminpass\"}" -H "Authorization: Bearer $bearer" + exit 0 fi curl -k -L --location 'https://localhost:8443/users' \ @@ -46,7 +48,3 @@ curl -k -L --location 'https://localhost:8443/users' \ touch /opt/opengnsys/ogCore/installer/.deployed exit 0 -~ -~ -~ -~ diff --git a/provision_oggui.sh b/provision_oggui.sh index 05736f3..7aba4d8 100644 --- a/provision_oggui.sh +++ b/provision_oggui.sh @@ -1,4 +1,6 @@ -#!/bin/bash +#!/bin/bash +# +set -x # preparar el fichero .env ENV_DIR=/opt/opengnsys/ogGui/etc/ @@ -6,10 +8,10 @@ ENV_FILE=$ENV_DIR/.env mkdir -p $ENV_DIR # Comprobar si ya se ha instalado ogCore -if [ -f /opt/opengnsys/ogGui/installer/.deployed ]; then - echo "ogCore ya instalado" - exit 0 -fi +#if [ -f /opt/opengnsys/ogGui/installer/.deployed ]; then +# echo "ogCore ya instalado" +# exit 0 +#fi # Sacar la IP del ogCore de la configuración ogcore_ip=$(jq -r '.ogcore_ip' /opt/opengnsys/ogGui/installer/config.json) @@ -25,8 +27,8 @@ if [ -z "$ogcore_ip" ]; then ip_address=$(ip -o -4 addr show "$interface" | awk '{print $4}' | cut -d'/' -f1) ogcore_ip=$ip_address # Si no se ha configurado la IP del ogCore, se escribe en el fichero .env - echo "NG_APP_BASE_API_URL=https://$OGCORE_IP:8443" > $ENV_FILE - exit 0 + echo "NG_APP_BASE_API_URL=https://$ogcore_ip:8443" > $ENV_FILE + exit 0 else echo "No se pudo determinar el interfaz asociado a la ruta por defecto." exit 1