X-Git-Url: https://git.pld-linux.org/?a=blobdiff_plain;f=rpcidmapd.init;h=cc8fc5c8ef4248f1ec198b2d76d29ddc79be8a4c;hb=b84f5be21ab9f63181d053347346f2fe012af2ac;hp=4860550c41d3ca0585a47566adde17c8c6c9e4ee;hpb=5141eb984b9855b22d05bc7594b059a251bae5ad;p=packages%2Fnfs-utils.git diff --git a/rpcidmapd.init b/rpcidmapd.init index 4860550..cc8fc5c 100644 --- a/rpcidmapd.init +++ b/rpcidmapd.init @@ -1,12 +1,10 @@ -#!/bin/bash +#!/bin/sh # -# rpcidmapd Start up and shut down RPC name to UID/GID mapper +# idmapd Start up and shut down RPC name to UID/GID mapper # -# Authors: Chuck Lever -# -# chkconfig: 345 12 83 -# description: Starts user-level daemon for NFSv4 that maps user \ -# names to UID and GID numbers. +# chkconfig: 345 12 83 +# description: Starts user-level daemon for NFSv4 that maps user \ +# names to UID and GID numbers. # Source function library. . /etc/rc.d/init.d/functions @@ -17,61 +15,56 @@ # Check that networking is up. if is_yes "${NETWORKING}"; then if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then - msg_network_down "RPC svcgssd daemon" + msg_network_down "RPC idmapd" exit 1 fi else exit 0 fi -if [ -x /sbin/pidof ] && [ "$1" != "stop" ]; then - [ -z "`/sbin/pidof portmap`" ] && nls "Error: portmap isn't running" && exit 0 -fi - # Get service config [ -f /etc/sysconfig/nfsfs ] && . /etc/sysconfig/nfsfs [ -f /etc/sysconfig/nfsd ] && . /etc/sysconfig/nfsd -# /usr may be on NFS, fail silently, nfsfs will start it -[ -x /usr/sbin/rpc.idmapd ] || exit 0 - # Find out what the current runlevel dir is RUNLEVELDIR=$(cat /var/run/runlevel.dir) start() { # Check if the service is already running? - if [ ! -f /var/lock/subsys/idmapd ]; then - # This is whacko, but we need /proc/fs/nfsd mounted before - # starting idmapd on NFS server - if [ -e "$RUNLEVELDIR"/S*nfs ]; then - if ! grep -q nfsd /proc/mounts ; then - modprobe -s nfsd > /dev/null 2>&1 - run_cmd "Mounting /proc/fs/nfsd filesystem" mount -t nfsd nfsd /proc/fs/nfsd - fi - fi - if ! grep -q rpc_pipefs /proc/mounts ; then - modprobe -s sunrpc >/dev/null 2>&1 - run_cmd "Mounting /var/lib/nfs/rpc_pipefs filesystem" \ - mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs - fi - - msg_starting "RPC idmapd" - daemon rpc.idmapd $RPCIDMAPOPTIONS - RETVAL=$? - [ $RETVAL -eq 0 ] && touch /var/lock/subsys/idmapd - else + if [ -f /var/lock/subsys/idmapd ]; then msg_already_running "RPC idmapd" + return + fi + + # This is whacko, but we need /proc/fs/nfsd mounted before + # starting idmapd on NFS server + if [ -e "$RUNLEVELDIR"/S*nfs ]; then + if ! grep -q nfsd /proc/mounts ; then + modprobe nfsd > /dev/null 2>&1 + run_cmd "Mounting /proc/fs/nfsd filesystem" mount -t nfsd nfsd /proc/fs/nfsd + fi + fi + if ! grep -q rpc_pipefs /proc/mounts; then + modprobe sunrpc >/dev/null 2>&1 + run_cmd "Mounting /var/lib/nfs/rpc_pipefs filesystem" \ + mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs fi + + msg_starting "RPC idmapd" + daemon /sbin/rpc.idmapd $RPCIDMAPOPTIONS + RETVAL=$? + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/idmapd } stop() { - if [ -f /var/lock/subsys/idmapd ]; then - msg_stopping "RPC idmapd" - killproc rpc.idmapd - rm -f /var/lock/subsys/idmapd - else + if [ ! -f /var/lock/subsys/idmapd ]; then msg_not_running "RPC idmapd" + return fi + + msg_stopping "RPC idmapd" + killproc rpc.idmapd + rm -f /var/lock/subsys/idmapd } # See how we were called. @@ -83,10 +76,6 @@ case "$1" in stop) stop ;; - status) - status rpc.idmapd - RETVAL=$? - ;; restart) stop start @@ -97,10 +86,14 @@ case "$1" in killproc rpc.idmapd -HUP RETVAL=$? else - msg_not_running "RPC idmapd" >&2 + msg_not_running "RPC idmapd" exit 7 fi ;; + status) + status rpc.idmapd + RETVAL=$? + ;; *) msg_usage "$0 {start|stop|restart|reload|status}" exit 1