#! /bin/bash

TAILS_USER_PASSWORD=live

log_and_exit()
{
    echo "`date "+day %j of %Y [%T]"` $1" >> /var/log/gdm3/tails-greeter.errors
    exit 0
}

# Import the name of the live user
. /etc/live/config.d/username || log_and_exit "Username file not found."
if [ -z "${LIVE_USERNAME}" ] ; then
    log_and_exit "Username variable not found."
fi

# Reset the password for default value
echo "${LIVE_USERNAME}:${TAILS_USER_PASSWORD}" | chpasswd

exit 0