summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRamón M. Gómez <ramongomez@us.es>2019-04-29 14:06:27 +0200
committerRamón M. Gómez <ramongomez@us.es>2019-04-29 14:06:27 +0200
commit7e26c8366910912ca23f5cc21f2f3d2c76931dd5 (patch)
tree9ed8cb9ed4278536ab5d484863a81def339c1c47
parent72eec764f5d49202587895f1f78ce5a2b59ba2a7 (diff)
#761: Fix bugs when parsing parameters; stop agent when client is halted.
-rw-r--r--admin/WebConsole3/frontend/package.json2
-rw-r--r--admin/WebConsole3/frontend/src/environments/environment.ts6
-rwxr-xr-xclient/shared/etc/init/default.sh26
-rwxr-xr-xclient/shared/scripts/poweroff8
-rwxr-xr-xclient/shared/scripts/reboot9
-rwxr-xr-xinstaller/opengnsys_update.sh2
6 files changed, 24 insertions, 29 deletions
diff --git a/admin/WebConsole3/frontend/package.json b/admin/WebConsole3/frontend/package.json
index 15f5d406..a2f353f5 100644
--- a/admin/WebConsole3/frontend/package.json
+++ b/admin/WebConsole3/frontend/package.json
@@ -59,8 +59,6 @@
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.3.0",
- "globunet-angular": "git+https://gitlab.globunet.com/globunet/angular2-shared.git",
- "globunet-schematics": "git+https://gitlab.globunet.com/globunet/globunet-angular-schematics.git",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.0.0",
diff --git a/admin/WebConsole3/frontend/src/environments/environment.ts b/admin/WebConsole3/frontend/src/environments/environment.ts
index 16b61e25..ef17e26d 100644
--- a/admin/WebConsole3/frontend/src/environments/environment.ts
+++ b/admin/WebConsole3/frontend/src/environments/environment.ts
@@ -1,7 +1,7 @@
// This file can be replaced during build by using the `fileReplacements` array.
// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
// The list of file replacements can be found in `angular.json`.
-const url = 'https://172.16.140.210/opengnsys3';
+const url = 'https://SERVERIP/opengnsys3';
export const environment = {
production: false,
BASE_URL: url,
@@ -9,8 +9,8 @@ export const environment = {
API_PUBLIC_URL: url + '/api',
API_BASE_URL: '/backend/web/app_dev.php/api',
OAUTH_DOMAIN: '/backend/web/app_dev.php/oauth/v2/token',
- OAUTH_CLIENT_ID: '1_23amzbdp4kskg80444oscko4w0w8wokocs88k0g8w88o4oggs4',
- OAUTH_CLIENT_SECRET: '46rttt2trwo4gocgoc4w80k4s8ok48sg8s84kk0cw48csks8o8',
+ OAUTH_CLIENT_ID: 'CLIENTID',
+ OAUTH_CLIENT_SECRET: 'CLIENTSECRET',
BASE_DIR: 'opengnsys3',
clientstatus: ['off', 'initializing', 'oglive', 'busy', 'linux', 'linux_session', 'macos', 'windows', 'windows_session'],
windowsboots: ['reboot', 'directo (kexec)'],
diff --git a/client/shared/etc/init/default.sh b/client/shared/etc/init/default.sh
index efc1e035..2d147c45 100755
--- a/client/shared/etc/init/default.sh
+++ b/client/shared/etc/init/default.sh
@@ -3,30 +3,31 @@
# Fichero de registro de incidencias (en el servidor; si no, en local).
OPENGNSYS=${OPENGNSYS:-/opt/opengnsys}
-OGLOGFILE=${OGLOGFILE:-$OPENGNSYS/log/$(ogGetIpAddress).log}
+OGLOGFILE=${OGLOGFILE:-$OPENGNSYS/log/$(ogGetIpAdderss).log}
if ! touch $OGLOGFILE 2>/dev/null; then
OGLOGFILE=/var/log/opengnsys.log
fi
LOGLEVEL=5
-# TODO - PRUEBA
-AGENT_FILE="/var/tmp/ogAdmClient"
-touch $AGENT_FILE
-chmod a+wxs $AGENT_FILE
-chown root:root $AGENT_FILE
-# Exportar funciones para comunicacion con el servidor
-sendConfigToServer
-sendStatusToServer "initializing"
-
# Matando plymount para inicir browser o shell
pkill -9 plymouthd
-# Arranque de OpenGnsys Client daemon (socket).
+# Cargar idioma.
echo "${MSG_LAUNCHCLIENT:-.}"
# Indicar fichero de teclado de Qt para el idioma especificado (tipo "es.qmap").
[ -f /usr/local/etc/${LANG%_*}.qmap ] && export QWS_KEYBOARD="TTY:keymap=/usr/local/etc/${LANG%_*}.qmap"
-if [ -x "$OPENGNSYS/bin/ogAdmClient" -a "$ogstatus" != "offline" ]; then
+VERSION="1.1.1" # TEMPORAL
+if [ -f "$OPENGNSYS/images/ogagent-oglive_${VERSION}_all.deb" -a "$ogstatus" != "offline" ]; then
+ # Instalar, configurar e iniciar agente.
+ dpkg -i "$OPENGNSYS/images/ogagent-oglive_${VERSION}_all.deb"
+ sed -i -e "s,remote=.*,remote=https://$(ogGetServerIp)/opengnsys3/backend/web/app_dev.php/," \
+ -e "s,client=.*,client=CLIENTID," \
+ -e "s,secret=.*,secret=CLIENTSECRET," \
+ /usr/share/OGAgent/cfg/ogagent.cfg
+ ogagent start
+ sleep 10
+elif [ -x "$OPENGNSYS/bin/ogAdmClient" -a "$ogstatus" != "offline" ]; then
# Ejecutar servicio cliente.
$OPENGNSYS/bin/ogAdmClient -f $OPENGNSYS/etc/ogAdmClient.cfg -l $OGLOGFILE -d $LOGLEVEL
else
@@ -42,3 +43,4 @@ if [ "$ogactiveadmin" == "true" ]; then
bash
fi
+
diff --git a/client/shared/scripts/poweroff b/client/shared/scripts/poweroff
index 7297cad3..563845b3 100755
--- a/client/shared/scripts/poweroff
+++ b/client/shared/scripts/poweroff
@@ -30,12 +30,10 @@ ethtool -s $DEVICE wol g 2>/dev/null
BUSYBOX=$(which busyboxOLD)
BUSYBOX=${BUSYBOX:-"busybox"}
-# Retardo para dar lugar al registro en cola de acciones.
-sleep 5
-# Parar Browser para evitar "cuelgues".
-[ "$ogstatus" == "offline" ] || pkill browser
+# Parar agente y Browser.
+ogagent stop &>/dev/null
+pkill -9 browser
-sendStatusToServer "off"
# Apagar.
$BUSYBOX poweroff
diff --git a/client/shared/scripts/reboot b/client/shared/scripts/reboot
index 5e6305af..30362cc7 100755
--- a/client/shared/scripts/reboot
+++ b/client/shared/scripts/reboot
@@ -44,12 +44,9 @@ ethtool -s $DEVICE wol g 2>/dev/null
BUSYBOX=$(which busyboxOLD)
BUSYBOX=${BUSYBOX:-"busybox"}
-# Retardo para dar lugar al registro en cola de acciones.
-sleep $TIME
-# Parar Browser para evitar "cuelgues".
-[ "$ogstatus" == "offline" ] || pkill browser
-
-sendStatusToServer "off"
+# Parar agente y Browser.
+ogagent stop &>/dev/null
+pkill -9 browser
# Reiniciar.
$BUSYBOX reboot
diff --git a/installer/opengnsys_update.sh b/installer/opengnsys_update.sh
index ec1b8394..b8d583dd 100755
--- a/installer/opengnsys_update.sh
+++ b/installer/opengnsys_update.sh
@@ -726,7 +726,7 @@ function updateWeb3()
sed -i "s/SERVERIP/$SERVERIP/" src/environments/environment.ts
sed -i 's,base href=.*,base href="/opengnsys3/frontend/">,' src/index.html
ng build
- rsync -irplt dist/opengnsysAngular6 $INSTALL_TARGET/www3/frontend
+ rsync -irplt dist/opengnsysAngular6/* $INSTALL_TARGET/www3/frontend
popd
}