#!/bin/bash

# CONTEXT: GUEST during CONSTRUCTION as ROOT
# PURPOSE: Add the guest image user that will own the trove agent source...if the user does not already exist

set -e
set -o xtrace

if ! id -u ${GUEST_USERNAME} >/dev/null 2>&1; then
    echo "Adding ${GUEST_USERNAME} user"
    useradd -G sudo -m ${GUEST_USERNAME} -s /bin/bash
    chown ${GUEST_USERNAME}:${GUEST_USERNAME} /home/${GUEST_USERNAME}
    passwd ${GUEST_USERNAME} <<_EOF_
${GUEST_USERNAME}
${GUEST_USERNAME}
_EOF_
fi

