integ/filesystem/nfs-utils/files/nfscommon
Scott Little bab9bb6b69 Internal restructuring of stx-integ
Create new directories:
   ceph
   config
   config-files
   filesystem
   kernel
   kernel/kernel-modules
   ldap
   logging
   strorage-drivers
   tools
   utilities
   virt

Retire directories:
   connectivity
   core
   devtools
   support
   extended

Delete two packages:
   tgt
   irqbalance

Relocated packages:
   base/
      dhcp
      initscripts
      libevent
      lighttpd
      linuxptp
      memcached
      net-snmp
      novnc
      ntp
      openssh
      pam
      procps
      sanlock
      shadow
      sudo
      systemd
      util-linux
      vim
      watchdog

   ceph/
      python-cephclient

   config/
      facter
      puppet-4.8.2
      puppet-modules

   filesystem/
      e2fsprogs
      nfs-utils
      nfscheck

   kernel/
      kernel-std
      kernel-rt

   kernel/kernel-modules/
      mlnx-ofa_kernel

   ldap/
      nss-pam-ldapd
      openldap

   logging/
      syslog-ng
      logrotate

   networking/
      lldpd
      iproute
      mellanox
      python-ryu
      mlx4-config

   python/
      python-2.7.5
      python-django
      python-gunicorn
      python-setuptools
      python-smartpm
      python-voluptuous

   security/
      shim-signed
      shim-unsigned
      tboot

   strorage-drivers/
      python-3parclient
      python-lefthandclient

   virt/
      cloud-init
      libvirt
      libvirt-python
      qemu

   tools/
      storage-topology
      vm-topology

   utilities/
      tis-extensions
      namespace-utils
      nova-utils
      update-motd

Change-Id: I37ade764d873c701b35eac5881eb40412ba64a86
Story: 2002801
Task: 22687
Signed-off-by: Scott Little <scott.little@windriver.com>
2018-08-01 10:06:31 -04:00

148 lines
3.2 KiB
Bash

#!/bin/sh
### BEGIN INIT INFO
# Provides: nfs-common
# Required-Start: $portmap hwclock
# Required-Stop: $portmap hwclock
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: NFS support for both client and server
# Description: NFS is a popular protocol for file sharing across
# TCP/IP networks. This service provides various
# support functions for NFS mounts.
### END INIT INFO
#
# Startup script for nfs-utils
#
#
# Location of executables:
# Source function library.
. /etc/init.d/functions
test -x "$NFS_STATD" || NFS_STATD=/usr/sbin/rpc.statd
test -x "$NFS_IDMAPD" || NFS_IDMAPD=/usr/sbin/rpc.idmapd
test -z "$STATD_PID" && STATD_PID=/var/run/rpc.statd.pid
#
# The default state directory is /var/lib/nfs
test -n "$NFS_STATEDIR" || NFS_STATEDIR=/var/lib/nfs
#
#
#----------------------------------------------------------------------
# Startup and shutdown functions.
# Actual startup/shutdown is at the end of this file.
#directories
create_directories(){
echo -n 'creating NFS state directory: '
mkdir -p "$NFS_STATEDIR"
( cd "$NFS_STATEDIR"
umask 077
mkdir -p rpc_pipefs
mkdir -p sm sm.bak statd
chown rpcuser:rpcuser sm sm.bak statd
test -w statd/state || {
rm -f statd/state
:>statd/state
}
umask 022
for file in xtab etab smtab rmtab
do
test -w "$file" || {
rm -f "$file"
:>"$file"
}
done
)
chown rpcuser:rpcuser "$NFS_STATEDIR"
echo done
}
# Parse the fstab and exports file, determine if we need idmapd.
#
NEED_IDMAPD=no
if [ -f /etc/fstab ]; then
exec 9<&0 </etc/fstab
while read DEV MTPT FSTYPE OPTS REST
do
case $DEV in
''|\#*)
continue
;;
esac
# FSTYPE "nfs" can be NFSv4 now
if [ "$FSTYPE" = "nfs4" ] || [ "$FSTYPE" = "nfs" ]; then
NEED_IDMAPD=yes
fi
done
exec 0<&9 9<&-
fi
if [ -f /etc/exports ] && grep -q '^[[:space:]]*[^#]*/' /etc/exports; then
NEED_IDMAPD=yes
fi
#
#idmapd
start_idmapd(){
if [ "$NEED_IDMAPD" = no ]; then
return
fi
mount -t rpc_pipefs rpc_pipefs $NFS_STATEDIR/rpc_pipefs
echo -n "starting idmapd: "
start-stop-daemon --start --exec "$NFS_IDMAPD"
echo done
}
stop_idmapd(){
if [ "$NEED_IDMAPD" = no ]; then
return
fi
echo -n 'stopping idmapd: '
start-stop-daemon --stop --quiet --name rpc.idmapd
umount $NFS_STATEDIR/rpc_pipefs 2>/dev/null
echo done
}
#statd
start_statd(){
echo -n "starting statd: "
start-stop-daemon --start --exec "$NFS_STATD" --pidfile "$STATD_PID"
echo done
}
stop_statd(){
echo -n 'stopping statd: '
start-stop-daemon --stop --quiet --signal 1 --pidfile "$STATD_PID"
echo done
}
#----------------------------------------------------------------------
#
# supported options:
# start
# stop
# restart: stops and starts mountd
#FIXME: need to create the /var/lib/nfs/... directories
case "$1" in
start)
create_directories
start_statd
start_idmapd;;
stop) stop_idmapd
stop_statd;;
status)
status $NFS_STATD;
RETVAL=$?
if [ "$NEED_IDMAPD" = yes ]
then
status $NFS_IDMAPD
rval=$?
[ $rval -ne 0 ] && exit $rval
fi
exit $RETVAL;;
restart)
$0 stop
$0 start;;
*)
echo "Usage: /etc/init.d/nfscommon {start|stop|status|restart}"
exit 1;;
esac