#!/bin/sh

# current user autocreation

if test -d "${WORKDIR}" ; then
    mkdir -p ${WORKDIR}/etc
    mkdir -p ${WORKDIR}/tmp/$(id -un)
    if test -z "$( grep -e"^$(id -un):x:" ${WORKDIR}/etc/passwd 2>/dev/null )" ; then
        printf "%s\n" "$(id -un):x:$(id -u):$(id -g):Current any user:/tmp/$(id -un):/bin/sh" >> ${WORKDIR}/etc/passwd
    fi
    if test -z "$( grep -e"^$(id -gn):x:" ${WORKDIR}/etc/group 2>/dev/null )" ; then
        printf "%s\n" "$(id -gn):x:$(id -g):" >> ${WORKDIR}/etc/group
    fi
fi
