summaryrefslogtreecommitdiffstats
path: root/client/shared/etc/init/default.sh
blob: f24548f0197b2dc6d5fbad1b6ece1ce9dd7eef32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
# Proceso general de arranque de OpenGnsys Client.


# Fichero de registro de incidencias (en el servidor; si no, en local).
OPENGNSYS=${OPENGNSYS:-/opt/opengnsys}
OGLOGFILE=${OGLOGFILE:-$OPENGNSYS/log/$(ogGetIpAdderss).log}
if ! touch $OGLOGFILE 2>/dev/null; then
    OGLOGFILE=/var/log/opengnsys.log
fi
LOGLEVEL=5

# Matando plymount para inicir browser o shell
pkill -9 plymouthd

# Arranque de OpenGnsys Client daemon (socket).
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 [ "$ogstatus" != "offline"  ]; then
    if ogFindCache &>/dev/null; then
        /opt/opengnsys/bin/tiptorrent --root /opt/opengnsys/cache/opt/opengnsys/images -n 3 &
    fi
    SERVER_CONFIG="/opt/opengnsys/ogClient/cfg/ogclient-$server.json"
    GROUP_CONFIG=/opt/opengnsys/ogClient/cfg/${group/ /_}.json
    PYMAJMIN=`python3 --version | cut -d" " -f2 | cut -d. -f1,2`
    export PYTHONPATH=/opt/opengnsys/lib/python$PYMAJMIN
    if [ -f $SERVER_CONFIG ]; then
        /opt/opengnsys/ogClient/./ogclient -c $SERVER_CONFIG
    elif [ -f $GROUP_CONFIG ]; then
        /opt/opengnsys/ogClient/./ogclient -c $GROUP_CONFIG
    else
        /opt/opengnsys/ogClient/./ogclient
    fi
else
    for FILE in index $OGGROUP $(ogGetIpAddress)
    do
	[ -f $OGCAC/menus/$FILE.html ] && OGMENU="$OGCAC/menus/$FILE.html"
    done
    $OPENGNSYS/bin/browser -qws $OGMENU
fi

# Si fallo en cliente y modo "admin", cargar shell; si no, salir.
if [ "$ogactiveadmin" == "true" ]; then
    bash
fi