Friday, January 28, 2011

How do i concatenate one map and one direct entry in automount ?

Hello,

i have this auto.master:

/data         yp:my_nis_map

on a particular linux workstation, i like to add a /data/special that is not present in my_nis_map.

/data         yp:my_nis_map
/data/special filer:/path/to/special

but this fails ? How can i concatenate two entries ? I can't modify the NIS or the NFS exports.

Thansk.

  • The maps cannot overlap. You could mount filer:/path/to/special somewhere else an make a symlink from /data/special to it. That symlink will be visible to all clients however.

    A cleaner though more involved approach would be to use an executable map. The map script would be something like:

    #!/bin/sh
    
    KEY="$0"
    if [ "$KEY" = "/data/special" ]; then
      echo " filer:/path/to/special"
      exit 0
    fi
    
    ypcat -k my_nis_map | egrep "^$KEY\s+" | sed "s/^$KEY//"
    exit 0
    

    (Warning: Script typed off the top of my head. NIS map musn't use \ for line continuation. I do not have access to NIS. May contain peanuts.)

    Edit: http://phaq.phunsites.net/2008/01/24/an-autofs-executable-map-to-automount-device-nodes/ gives an example of an executable map.

    From embobo

0 comments:

Post a Comment