Launch browser with new wrapper

browser
Vadim vtroshchinskiy 2025-02-17 08:53:25 +01:00
parent e103f9bf6a
commit 76950c8c11
3 changed files with 115 additions and 17 deletions

View File

@ -0,0 +1,43 @@
#!/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
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 $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/launch_browser
fi
# Si fallo en cliente y modo "admin", cargar shell; si no, salir.
if [ "$ogactiveadmin" == "true" ]; then
bash
fi

View File

@ -1,17 +0,0 @@
#!/bin/bash
# argumentos $0 -qws url
ignored_args="$1"
url="$2"
mkdir -p $HOME/.config/sway
echo "exec OGBrowser $url" > $HOME/.config/sway/config
mkdir -p $HOME/.config/i3
echo "exec OGBrowser $url" > $HOME/.config/i3/config
echo "exec i3" > $HOME/.xinitrc
sway || startx

View File

@ -0,0 +1,72 @@
#!/bin/bash
# Compatibilidad con los argumentos usados con el browser original:
# browser -qws http://google.com
#
while getopts ":qws" opt ; do
case $opt in
q)
echo "Ignoring option: -q"
;;
w)
echo "Ignoring option: -w"
;;
s)
echo "Ignoring option: -s"
;;
esac
done
shift $(expr $OPTIND - 1 )
url="$1"
echo "URL: $url"
rm -rf "/run/sway.started" "/run/x11.started"
mkdir -p $HOME/.config/sway
echo "exec /usr/bin/OGBrowser $url" > $HOME/.config/sway/config
echo "exec touch /run/sway.started" >> $HOME/.config/sway/config
mkdir -p $HOME/.config/i3
echo "exec OGBrowser $url" > $HOME/.config/i3/configc
echo "exec touch /run/x11.started" >> $HOME/.config/i3/config
echo "exec /usr/bin/i3" > $HOME/.xinitrc
echo "exec /usr/bin/xterm" >> $HOME/.xinitrc
# Make sure libinput works
/usr/bin/udevadm trigger
if [ -x "/usr/bin/sway" ] ; then
echo "*** Trying to launch Sway ***"
/usr/bin/sway
else
echo Sway not installed in this image, skipping.
fi
if [ ! -f "/run/sway.started" ] ; then
if [ -x "/usr/bin/startx" ] ; then
echo "*** Trying to launch X11 ***"
/usr/bin/startx
else
echo X11 not installed in this image, skipping.
fi
else
echo "Sway was run before, not starting X11".
fi
if [ ! -f "/run/sway.started" -a ! -f "/run/x11.started" ] ; then
echo "Everything failed, dropping into a shell."
exec /usr/bin/bash
else
echo "All done."
fi