#!/bin/sh

set -e

success() { echo "success: $0:" $@; }
error() {   echo "error: $0:" $@; }

PROFILE=
if test -r /etc/debian-edu/config ; then
    . /etc/debian-edu/config
fi

# Automount is not used on the Main-Server, Roaming workstation and
# Standalone profiles.
if echo "$PROFILE" | egrep -q 'Main-Server|Roaming-Workstation|Standalone' ; then
    exit 0
fi

if pidof automount > /dev/null ; then
    success "automount is running."
else
    error "automount is not running."
    exit 1
fi

# Try to visit the default home directory, to verify that it exist and
# trigger autofs to mount it.
if cd /skole/tjener/home0/ ; then
    success "directory /skole/tjener/home0/ exist"
    if grep -q /skole/tjener/home0 /proc/mounts ; then
	success "mount point /skole/tjener/home0/ exist."
    fi
else
    error "unable to cd into /skole/tjener/home0/ (is DNS name of this machine in required netgroup?)"
fi
