aboutsummaryrefslogtreecommitdiff
path: root/scripts/hostname/nfs1/30-autofs
blob: 0393accb55514fcfbbfe6e77fd51eb2ea262861d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/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

# auto_home: *
ldap_add "automountKey=*,automountMapName=auto_home,${automount_basedn}" <<EOF
objectClass: automount
automountKey: *
automountInformation: ${fqdn}:/user/&/priv
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}
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
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