mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
2.8 KiB

  1. #!/bin/sh
  2. #
  3. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  4. #
  5. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  6. # Please add additional copyright information _after_ the line containing
  7. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  8. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  9. #
  10. # ROCK Linux: rock-src/package/base/autofs/autofs.init
  11. # ROCK Linux is Copyright (C) 1998 - 2004 Clifford Wolf
  12. #
  13. # This program is free software; you can redistribute it and/or modify
  14. # it under the terms of the GNU General Public License as published by
  15. # the Free Software Foundation; either version 2 of the License, or
  16. # (at your option) any later version. A copy of the GNU General Public
  17. # License can be found at Documentation/COPYING.
  18. #
  19. # Many people helped and are helping developing ROCK Linux. Please
  20. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  21. # file for details.
  22. #
  23. # --- ROCK-COPYRIGHT-NOTE-END ---
  24. #
  25. # Desc: Kernel Automounter Daemon
  26. # Runlevel: 74 rcX
  27. #
  28. PATH=/sbin:/usr/sbin:/bin:/usr/bin
  29. export PATH
  30. # We can add local options here
  31. # e.g. localoptions='rsize=8192,wsize=8192'
  32. #
  33. localoptions=''
  34. function getmounts()
  35. {
  36. if [ -f /etc/auto.master ]
  37. then
  38. cat /etc/auto.master | sed -e '/^#/d' -e '/^$/d'| (
  39. while read dir map options
  40. do
  41. if [ ! -z "$dir" -a ! -z "$map" \
  42. -a "$(echo "$map" | cut -c1)" != "-" ]
  43. then
  44. map=$(echo "/etc/$map" | sed -e 's:^/etc//:/:')
  45. options=$(echo "$options" | sed -e 's/\(^\|[ \t]\)-/\1/g')
  46. if [ -x $map ]; then
  47. echo "automount $dir program $map $options $localoptions"
  48. elif [ -f $map ]; then
  49. echo "automount $dir file $map $options $localoptions"
  50. else
  51. echo "automount $dir $(basename $map) $options $localoptions"
  52. fi
  53. fi
  54. done
  55. )
  56. fi
  57. }
  58. function status()
  59. {
  60. echo "Configured Mount Points:"
  61. echo "------------------------"
  62. getmounts
  63. echo ""
  64. echo "Active Mount Points:"
  65. echo "--------------------"
  66. ps ax|grep "[0-9]:[0-9][0-9] automount " | (
  67. while read pid tt stat time command; do echo $command; done
  68. )
  69. }
  70. main_begin
  71. block_begin(start, `Starting automounter.')
  72. check(`getmounts | sh -e')
  73. block_end
  74. block_begin(stop, `Stopping automounter.')
  75. check(`killall automount')
  76. if sleep 1 ; [ "$(pidof /usr/sbin/automount)" ] ; then
  77. check(`killall -9 automount')
  78. fi
  79. if sleep 1 ; [ "$(pidof /usr/sbin/automount)" ] ; then
  80. echo "Not able to stop processes: $(pidof /usr/sbin/automount)"
  81. IN error=1
  82. fi
  83. block_end
  84. block_begin(status)
  85. status
  86. block_end
  87. main_end