#!/bin/bash
# last-mod: arturo@2020-4-15
# Configuramos tuxpaint a pantalla completa

# Primero comprobamos además que tuxpaint este instalado...si no lo esta no hariamos nada....
if [[ -f "/etc/tuxpaint/tuxpaint.conf" ]] ; then
    if [[ "$(lsb_release -sr)" != "18.04" ]] ; then
        # En la 14.04 funcionaba así:
        sed -i 's/# fullscreen=yes/fullscreen=native/' /etc/tuxpaint/tuxpaint.conf
    else
        # En la 18.04 se descomentan demasiadas líneas, hay que ser más explicito:
        sed -i "s/# fullscreen=yes/fullscreen=yes/g" /etc/tuxpaint/tuxpaint.conf
        sed -i "s/fullscreen=native/#fullscree=native/g" /etc/tuxpaint/tuxpaint.conf
        if (( $(grep ^fullscreen= /etc/tuxpaint/tuxpaint.conf | wc -l) > 1 )) ; then
            sed -i "/^fullscreen=.*/d" /etc/tuxpaint/tuxpaint.conf
        fi
        if ! grep -E ^fullscreen=yes /etc/tuxpaint/tuxpaint.conf > /dev/null 2>&1 ; then
            echo "fullscreen=yes" >> /etc/tuxpaint/tuxpaint.conf
        fi
    fi
    echo "=> Se ha configurado tux-paint a pantalla completa"
fi