#!/bin/bash

ln -sf /usr/share/plymouth/themes/zentyal/zentyal.plymouth /etc/alternatives/default.plymouth
ln -sf /usr/share/plymouth/themes/zentyal/zentyal.grub /etc/alternatives/default.plymouth.grub

if [ "$1" == "configure" ] && [ -z "$2" ]
then
    systemctl disable lxdm.service || true
fi

USER_NAME=`getent passwd uid 1000 | cut -d: -f1`
DIR=/home/$USER_NAME
LIBFM_DIR=$DIR/.config/libfm

if [ ! -d $LIBFM_DIR ] && [ -f $DIR/Desktop/root-terminal.desktop ]
then
    mkdir -p $LIBFM_DIR
    mv /usr/share/zenbuntu-desktop/lxde/libfm.conf $LIBFM_DIR/
    sed -i -e 's/pkexec/bash -c "pkexec/' -e 's/XAUTHORITY lxterminal$/XAUTHORITY lxterminal"/' $DIR/Desktop/root-terminal.desktop
fi