#!/bin/bash
#
# script to grade autofs mounted home directories
# by Joshua M. Hoffman

TEST_USER=ldapuser1
TEST_HOME_DIR=/home/guests/ldapuser1

data="$(su - $TEST_USER -c pwd 2>/dev/null)"

if [[ "$data" = "$TEST_HOME_DIR" ]]; then

    if mount | grep $TEST_USER | grep -q nfs; then
        echo "PASSED: autofs mounted home directories"
        exit
    fi
fi

# if we got this far autofs home directories are not working
cat <<EOL

Home directory mounting via autofs is not working.

Please check your configuration and try again.

EOL

exit
