#!/bin/sh

# use fred for .face
cp /usr/share/icons/hicolor/scalable/emblems/emblem-aptosid-fred.svg /etc/skel/.face

adduser --disabled-password --gecos "${FLL_LIVE_USER}" "${FLL_LIVE_USER}"

# Create sudoers.d snippet
if [ ! -e "/etc/sudoers.d/15_${FLL_LIVE_USER}" ]; then
    # append sudoers entry
    cat >> "/etc/sudoers.d/15_${FLL_LIVE_USER}" <<EOF
# WARNING: This allows the unprivileged ${FLL_LIVE_USER} user to start commands as root
# WARNING: This is totally insecure and (almost) makes ${FLL_LIVE_USER} a second root account.
# WARNING: Never allow external access to the ${FLL_LIVE_USER} user!!!
${FLL_LIVE_USER} ALL=(ALL:ALL) NOPASSWD: ALL
EOF
    chmod 0440 "/etc/sudoers.d/15_${FLL_LIVE_USER}"
fi

adduser "${FLL_LIVE_USER}" sudo
