Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.4
autofs.import5072
autofs-suse-autofs_init.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File autofs-suse-autofs_init.patch of Package autofs.import5072
Index: autofs-5.0.5/samples/rc.autofs.in =================================================================== --- autofs-5.0.5.orig/samples/rc.autofs.in +++ autofs-5.0.5/samples/rc.autofs.in @@ -1,20 +1,34 @@ #!/bin/bash # -# rc file for automount using a Sun-style "master map". -# -# On most distributions, this file should be called: -# /etc/rc.d/init.d/autofs or /etc/init.d/autofs or /etc/rc.d/rc.autofs +# Copyright (C) 2011 SUSE Linux Products GmbH, Nuernberg, Germany. # +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # + ### BEGIN INIT INFO -# Provides: autofs -# Required-Start: $network $ypbind -# Required-Stop: $network $ypbind -# Default-Start: 3 4 5 -# Default-Stop: 0 1 2 6 -# Short-Description: Automounts filesystems on demand -# Description: Automounts filesystems on demand +# Provides: autofs +# Required-Start: $network $syslog $remote_fs +# Should-Start: $portmap ypbind keyserv ldap gssd nfsserver network-remotefs +# Required-Stop: $network $syslog $remote_fs +# Should-Stop: $portmap ypbind keyserv ldap gssd nfsserver network-remotefs +# Default-Start: 3 5 +# Default-Stop: +# Short-Description: automatic mounting of filesystems +# Description: Start the autofs daemon for automatic mounting of filesystems. ### END INIT INFO + # # Location of the automount daemon and the init directory # @@ -23,42 +37,40 @@ prog=`basename $DAEMON` MODULE="autofs4" DEVICE="autofs" confdir=@@autofsconfdir@@ +PIDFILE=/var/run/automount.pid -test -e $DAEMON || exit 0 +test -x $DAEMON || exit 5 PATH=/sbin:/usr/sbin:/bin:/usr/bin export PATH +. /etc/rc.status + # -# load customized configuation settings +# Load customized configuration settings # if [ -r $confdir/autofs ]; then . $confdir/autofs fi function start() { - echo -n "Starting $prog: " - # Make sure autofs4 module is loaded - if ! grep -q autofs /proc/filesystems - then + if ! grep -q autofs /proc/filesystems; then # Try load the autofs4 module fail if we can't - modprobe $MODULE >/dev/null 2>&1 - if [ $? -eq 1 ] - then - echo "Error: failed to load autofs4 module." + modprobe -q $MODULE >/dev/null 2>&1 + if [ $? -eq 1 ]; then + echo "Error: failed to load $MODULE module." return 1 fi - elif ([ -f /proc/modules ] && lsmod) | grep -q autofs[^4] - then - # wrong autofs filesystem module loaded + elif ([ -f /proc/modules ] && lsmod) | grep -q autofs[^4]; then + # Wrong autofs filesystem module loaded echo - echo "Error: autofs kernel module is loaded, autofs4 required" + echo "Error: autofs kernel module is loaded, $MODULE required" return 1 fi - # Check misc device - if [ -n "$USE_MISC_DEVICE" -a "x$USE_MISC_DEVICE" = "xyes" ]; then + # Use the AutoFS misc device unless it is explicitly disabled + if [ -z "$USE_MISC_DEVICE" -o "x$USE_MISC_DEVICE" = "xyes" ]; then sleep 1 if [ -e "/proc/misc" ]; then MINOR=`awk "/$DEVICE/ {print \\$1}" /proc/misc` @@ -75,79 +87,86 @@ function start() { fi fi - $prog $OPTIONS - RETVAL=$? - if [ $RETVAL -eq 0 ] ; then - echo "done." - else - echo "failed." + if [ "$LOCAL_OPTIONS" ]; then + AUTOFS_OPTIONS="-O $LOCAL_OPTIONS $AUTOFS_OPTIONS" fi - return $RETVAL -} + /sbin/startproc -w $DAEMON -p $PIDFILE $AUTOFS_OPTIONS -function stop() { - echo -n $"Stopping $prog: " - count=0 - while [ -n "`pidof $prog`" -a $count -lt 15 ] ; do - killall -TERM $prog >& /dev/null - RETVAL=$? - [ $RETVAL = 0 -a -z "`pidof $prog`" ] || sleep 3 - count=`expr $count + 1` - done - if [ -z "`pidof $prog`" ] ; then - echo "done." - else - echo "failed." - fi - return $RETVAL -} - -function restart() { - stop - start + return $? } -function reload() { - pid=`pidof $prog` - if [ -z $pid ]; then - echo $"$prog not running" - RETVAL=1 - else - kill -HUP $pid 2> /dev/null - echo $"Reloading maps" - RETVAL=0 - fi - return $RETVAL +function stop() { + # Send SIGTERM first and set a maximum wait time of 45 seconds + # before sending SIGKILL + /sbin/killproc -t 45 -p $PIDFILE $DAEMON } RETVAL=0 case "$1" in start) - start - ;; - forcestart) - OPTIONS="$OPTIONS --force" - start + echo -n "Starting $prog " + # Check if already running + if ! /sbin/checkproc $DAEMON; then + start + fi + + rc_status -v ;; stop) + echo -n "Shutting down $prog " stop + + rc_status -v + ;; + force-stop) + $0 stop + + ;; + try-restart|condrestart) + ## Do a restart only if the service was active before. + ## Note: try-restart is now part of LSB (as of 1.9). + if test "$1" = "condrestart"; then + echo "${attn}Use try-restart ${done}(LSB)${attn}${norm}" + fi + $0 status + if test $? = 0; then + $0 restart + else + rc_reset # Not running is not a failure. + fi + # Remember status and be quiet + rc_status ;; restart) - restart + $0 stop + $0 start + + rc_status ;; - forcerestart) - OPTIONS="$OPTIONS --force" - restart + force-reload|reload) + echo -n "Reload service $prog " + /sbin/killproc -HUP $DAEMON + + rc_status -v ;; - reload) - reload + force-expire) + echo -n "Forcing expire of auto mounted filesystems " + /sbin/killproc -USR1 $DAEMON + + rc_status -v + ;; + status) + echo -n "Checking for service $prog " + /sbin/checkproc $DAEMON + # NOTE: rc_status knows that we called this init script with + # "status" option and adapts its messages accordingly. + rc_status -v ;; *) - echo $"Usage: $0 {start|forcestart|stop|restart|forcerestart|reload}" - exit 1; + echo "Usage: $0 {start|stop|status|try-restart|restart|reload|force-expire}" + exit 1 ;; esac -exit $? - +rc_exit
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor