From b9e96c5dc09eaff29c7265cecde8f206f2cab729 Mon Sep 17 00:00:00 2001 From: Exequiel Aramburu Date: Tue, 29 Sep 2026 02:56:47 -0300 Subject: [PATCH] se adecua el generarDeb --- build/Deb64/usr/share/applications/emalibre.desktop | 2 +- build/{Deb64/etc => tmp}/emalibre_modo | 0 build/{Deb64/etc => tmp}/init.d/emalibre | 0 empaquetarLinux.js | 10 +++++++++- generarDeb64.sh | 12 ++++++------ 5 files changed, 16 insertions(+), 8 deletions(-) rename build/{Deb64/etc => tmp}/emalibre_modo (100%) rename build/{Deb64/etc => tmp}/init.d/emalibre (100%) diff --git a/build/Deb64/usr/share/applications/emalibre.desktop b/build/Deb64/usr/share/applications/emalibre.desktop index 91b42bb..24da0ba 100755 --- a/build/Deb64/usr/share/applications/emalibre.desktop +++ b/build/Deb64/usr/share/applications/emalibre.desktop @@ -7,7 +7,7 @@ GenericName=EMA Libre Comment=Estación Meteorológica Automática Libre Categories=Utility; Icon=/usr/share/emalibre/gui_common/iconos/icono_app.png -Actions=RootWindow;Window +Actions=RootWindow;Window; [Desktop Action Window] Name=EmaLibre diff --git a/build/Deb64/etc/emalibre_modo b/build/tmp/emalibre_modo similarity index 100% rename from build/Deb64/etc/emalibre_modo rename to build/tmp/emalibre_modo diff --git a/build/Deb64/etc/init.d/emalibre b/build/tmp/init.d/emalibre similarity index 100% rename from build/Deb64/etc/init.d/emalibre rename to build/tmp/init.d/emalibre diff --git a/empaquetarLinux.js b/empaquetarLinux.js index 42903da..12b04b8 100644 --- a/empaquetarLinux.js +++ b/empaquetarLinux.js @@ -1,5 +1,5 @@ import nwbuild from 'nw-builder'; -import {readFileSync} from 'node:fs'; +import {readFileSync, renameSync, writeFileSync} from 'node:fs'; const runtime = JSON.parse(readFileSync(new URL('./src/runtime.json', import.meta.url))); await nwbuild({ mode: 'build', srcDir: './src', glob: false, @@ -7,4 +7,12 @@ await nwbuild({ outDir: './build/emalibre', zip: false, app: {name: 'emalibre'} }); +// Mantener el runtime junto a sus bibliotecas y arrancar desde la raíz de la app. +renameSync('./build/emalibre/emalibre', './build/emalibre/nw'); +writeFileSync('./build/emalibre/emalibre', `#!/bin/sh +set -eu +APP_DIR=$(dirname "$(readlink -f "$0")") +cd "$APP_DIR/package.nw" +exec "$APP_DIR/nw" . "$@" +`, {mode: 0o755}); console.log('Correcto!'); diff --git a/generarDeb64.sh b/generarDeb64.sh index 4a9e609..10b395e 100755 --- a/generarDeb64.sh +++ b/generarDeb64.sh @@ -186,6 +186,9 @@ log_ok " --> OK." log_info "2) Copiando los fuentes de EMA Libre para 64 bits." sudo cp -R "$EMALIBRE_DIR/"* "$DEB_DIR/usr/share/emalibre/" +# Las plantillas también se usan para web, cuya raíz no contiene package.nw. +sudo sed -i 's|^Icon=.*|Icon=/usr/share/emalibre/package.nw/gui_common/iconos/icono_app.png|; s|^Actions=.*|Actions=RootWindow;Window;|' "$DEB_DIR/usr/share/applications/emalibre.desktop" +sudo sed -i 's|^icon=.*|icon="/usr/share/emalibre/package.nw/gui_common/iconos/icono_app.png"|' "$DEB_DIR/usr/share/menu/emalibre" log_ok " --> OK." log_info "3) Reemplazando el archivo de control DEB." @@ -199,9 +202,7 @@ sudo chown -R root:root "$DEB_DIR" log_ok " --> OK." log_info "5) Generando enlaces simbólicos del binario." -cd "$DEB_DIR/usr/bin/" -sudo ln -sf ../share/emalibre/emalibre emalibre -cd ../../.. +sudo ln -sf ../share/emalibre/emalibre "$DEB_DIR/usr/bin/emalibre" log_ok " --> OK." log_info "6) Eliminando node/web/express/forever/servicio para modo GUI y la interfaz para el modo web." @@ -217,9 +218,7 @@ log_ok " --> OK." log_info "7) Generando Paquete DEB para GUI 64 bits Linux." #sudo dpkg -b Deb64 debs/"emalibre-gui-linux_$VERSION.deb" -sudo dpkg-deb -Zxz -b Deb64 debs/"emalibre-gui-linux_$VERSION.deb" - -cd .. +sudo dpkg-deb -Zxz -b "$DEB_DIR" "$DEBS_OUT/emalibre-gui-linux_$VERSION.deb" mv "$TMP_DIR/init.d" "$DEB_DIR/etc" 2>/dev/null || true mv "$TMP_DIR/emalibre_modo" "$DEB_DIR/etc/emalibre_modo" 2>/dev/null || true log_final " Finalizó con éxito, build/debs/emalibre-gui-linux_$VERSION.deb." @@ -258,6 +257,7 @@ log_ok " --> OK." log_info "3) Remplazando el archivo de control DEB." sudo cp -f "$CONTROL_DEB/control_linux_web" "$DEB_DIR/DEBIAN/control" +sudo sed -i 's|/emalibre/package.nw/gui_common/|/emalibre/gui_common/|' "$DEB_DIR/usr/share/applications/emalibre.desktop" "$DEB_DIR/usr/share/menu/emalibre" log_ok " --> OK." log_info "4) Aplicando permisos necesarios."