Comment 2 for bug 533029

Revision history for this message
Andrew Pollock (apollock) wrote : Re: autofs5-ldap needs an upstart job

Sounds like I was experiencing bug #406397

Here's the Upstart job I'm currently using, which seems to be working insofar as it starts autofs. It hasn't solved the problem I was trying to solve though.

description "automounter"
author "Andrew Pollock <email address hidden>"

start on (net-device-up IFACE!=lo)
stop on runlevel [!2345]

expect fork
respawn

pre-start script
 . /etc/default/autofs

 # Make sure the (right) kernel module is loaded
 if ! grep -q autofs /proc/filesystems; then
  if ! modprobe autofs4 >/dev/null 2>&1; then
   echo "Error: failed to load autofs4 module"
   exit 1
  fi
 elif [ -f /proc/modules ] && grep -q ^autofs[^4] /proc/modules; then
  # wrong autofs filesystem module loaded
  echo
  echo "Error: autofs kernel module is loaded, autofs4 required"
  exit 1
 fi

 # Check misc device
 if [ -n "$USE_MISC_DEVICE" -a "$USE_MISC_DEVICE" = "yes" ]; then
  sleep 1
  if [ -e "/proc/misc" ]; then
   MINOR=$(awk '/autofs/ { print $1 }' /proc/misc)
   if [ -n "$MINOR" -a ! -c "/dev/autofs" ]; then
    mknod -m 0600 /dev/autofs c 10 $MINOR
   fi
  fi
  if [ -x /sbin/restorecon -a -c /dev/autofs ]; then
   /sbin/restorecon /dev/autofs
  fi
 else
  if [ -c /dev/autofs ]; then
   rm /dev/autofs
  fi
 fi
end script

exec /usr/sbin/automount