oglive-builder/includes/usr/bin/launch_browser

73 lines
1.5 KiB
Bash

#!/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