#!/bin/sh

#     DESCRIPTION
#
# Update xfce sessions


#     REQUIRES
#
# Nothing


#     INFO
#

NAME="init5-xfce-session"

verbose()
{
    if [ -n "$GLOBAL_VERBOSE" ]; then
        echo "HOOK: $NAME: $@"
    fi
}

verbose "has started"

word=""

config="/etc/skel/.config/xfce4-session/xfce4-session.rc"

if [ -f "$config" ]; then
    verbose "Modify xfce-sessions"
    echo "[General]" >> "$config"
    echo "HibernateButton=false" >> "$config"
    echo "SuspendButton=false" >> "$config"
else
    verbose "Can't modify xfce-sessions"
fi

sudoers="$(visudo -c | awk '{print $1}')"
if [ ! -f "$sudoers" ]; then
     echo "Cannot read sudoers file <$sudoers>."
fi

echo '%users ALL = NOPASSWD: /usr/lib/xfsm-shutdown-helper' >> "$sudoers"

verbose "finished"
