#!/bin/sh
nfs_mount_opts='-nfsv4,gssname=host,sec=krb5p'
# /home: auto_home
ldap_add "automountKey=/home,automountMapName=auto_master,${automount_basedn}" <<EOF
objectClass: automount
automountKey: /home
automountInformation: auto_home ${nfs_mount_opts}
EOF
ldap_add "automountMapName=auto_home,${automount_basedn}" <<EOF
objectClass: automountMap
automountMapName: auto_home
EOF
# /nfs/user: auto_user
ldap_add "automountKey=/nfs/user,automountMapName=auto_master,${automount_basedn}" <<EOF
objectClass: automount
automountKey: /nfs/user
automountInformation: auto_user ${nfs_mount_opts}
EOF
ldap_add "automountMapName=auto_user,${automount_basedn}" <<EOF
objectClass: automountMap
automountMapName: auto_user
EOF
# auto_user: $user/{pub,priv}
# auto_home: $user
for userquota in ${nfs_homedirs:-}; do
user=$(echo "$userquota" | awk -F: '{print $1}')
ldap_add "automountKey=${user},automountMapName=auto_user,${automount_basedn}" <<EOF
objectClass: automount
automountKey: ${user}
automountInformation: /priv ${fqdn}:/user/&/priv /pub ${fqdn}:/user/&/pub
EOF
ldap_add "automountKey=${user},automountMapName=auto_home,${automount_basedn}" <<EOF
objectClass: automount
automountKey: ${user}
automountInformation: ${fqdn}:/user/&/priv
EOF
done
# /nfs/group: auto_group
ldap_add "automountKey=/nfs/group,automountMapName=auto_master,${automount_basedn}" <<EOF
objectClass: automount
automountKey: /nfs/group
automountInformation: auto_group ${nfs_mount_opts}
EOF
ldap_add "automountMapName=auto_group,${automount_basedn}" <<EOF
objectClass: automountMap
automountMapName: auto_group
EOF
# auto_group: $group/{pub,priv}
for groupquota in ${nfs_groupdirs:-}; do
group=$(echo "$groupquota" | awk -F: '{print $1}')
ldap_add "automountKey=${group},automountMapName=auto_group,${automount_basedn}" <<EOF
objectClass: automount
automountKey: ${group}
automountInformation: /priv ${fqdn}:/group/&/priv /pub ${fqdn}:/group/&/pub
EOF
done
# /nfs/media: auto_media
ldap_add "automountMapName=auto_media,${automount_basedn}" <<EOF
objectClass: automountMap
automountMapName: auto_media
EOF
ldap_add "automountKey=/nfs/media,automountMapName=auto_master,${automount_basedn}" <<EOF
objectClass: automount
automountKey: /nfs/media
automountInformation: auto_media ${nfs_mount_opts}
EOF
# auto_media: music
ldap_add "automountKey=music,automountMapName=auto_media,${automount_basedn}" <<EOF
objectClass: automount
automountKey: music
automountInformation: ${fqdn}:/media/music
EOF