Updated pre and post files
parent
b2d34a6880
commit
2b3f7b6e34
|
@ -1,7 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
set -x
|
|
||||||
|
|
||||||
. /usr/share/debconf/confmodule
|
. /usr/share/debconf/confmodule
|
||||||
|
|
||||||
|
@ -12,14 +11,14 @@ OGMERCURE_URL="$RET"
|
||||||
|
|
||||||
# Asegurarse de que el usuario exista
|
# Asegurarse de que el usuario exista
|
||||||
USER="opengnsys"
|
USER="opengnsys"
|
||||||
HASH_FILE="/opt/opengnsys/oggui/var/lib/oggui/oggui.config.hash"
|
|
||||||
CONFIG_FILE="/opt/opengnsys/oggui/browser/assets/config.json"
|
CONFIG_FILE="/opt/opengnsys/oggui/browser/assets/config.json"
|
||||||
|
|
||||||
# Detectar si es una instalación nueva o una actualización
|
# Detectar si es una instalación nueva o una actualización
|
||||||
if [ "$1" = "configure" ] && [ -z "$2" ]; then
|
if [ "$1" = "configure" ] && [ -z "$2" ]; then
|
||||||
jq --arg apiUrl "$OGCORE_URL" --arg mercureUrl "$OGMERCURE_URL" \
|
if [ ! -f "$CONFIG_FILE" ]; then
|
||||||
'.apiUrl = $apiUrl | .mercureUrl = $mercureUrl' "$CONFIG_FILE" > "${CONFIG_FILE}.tmp" && mv "${CONFIG_FILE}.tmp" "$CONFIG_FILE"
|
jq --arg apiUrl "$OGCORE_URL" --arg mercureUrl "$OGMERCURE_URL" \
|
||||||
ln -s /opt/opengnsys/oggui/etc/systemd/system/oggui.service /etc/systemd/system/oggui.service
|
'.apiUrl = $apiUrl | .mercureUrl = $mercureUrl' "$CONFIG_FILE" > "${CONFIG_FILE}.tmp" && mv "${CONFIG_FILE}.tmp" "$CONFIG_FILE"
|
||||||
|
fi
|
||||||
ln -s /opt/opengnsys/oggui/etc/nginx/oggui.conf /etc/nginx/sites-enabled/oggui.conf
|
ln -s /opt/opengnsys/oggui/etc/nginx/oggui.conf /etc/nginx/sites-enabled/oggui.conf
|
||||||
ln -s $CONFIG_FILE /opt/opengnsys/oggui/etc/config.json
|
ln -s $CONFIG_FILE /opt/opengnsys/oggui/etc/config.json
|
||||||
mkdir -p /etc/nginx/certs/
|
mkdir -p /etc/nginx/certs/
|
||||||
|
|
|
@ -3,9 +3,8 @@
|
||||||
set -e
|
set -e
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
if [ "$1" = "upgrade" ]; then
|
# Solo eliminar archivos de configuración si se está eliminando el paquete
|
||||||
# Eliminar enlaces simbólicos creados en postinst
|
if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then
|
||||||
rm -f /etc/systemd/system/oggui.service
|
|
||||||
rm -f /etc/nginx/sites-enabled/oggui.conf
|
rm -f /etc/nginx/sites-enabled/oggui.conf
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl restart nginx
|
systemctl restart nginx
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=Aplicación Angular con Nginx
|
|
||||||
After=network.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
ExecStart=/opt/opengnsys/oggui/bin/start-oggui.sh
|
|
||||||
Restart=always
|
|
||||||
User=www-data
|
|
||||||
WorkingDirectory=/var/www/mi-aplicacion
|
|
||||||
Environment=NODE_ENV=production
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
Loading…
Reference in New Issue