summaryrefslogtreecommitdiffstats
path: root/abs/core
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core')
-rwxr-xr-xabs/core/runit-scripts/PKGBUILD2
-rwxr-xr-xabs/core/runit-scripts/runitscripts/services/nfs-common/finish51
-rwxr-xr-xabs/core/runit-scripts/runitscripts/services/nfs-common/run81
-rwxr-xr-xabs/core/runit-scripts/runitscripts/services/nfsd/run63
-rwxr-xr-xabs/core/runit-scripts/runitscripts/services/rpcbind/run7
5 files changed, 192 insertions, 12 deletions
diff --git a/abs/core/runit-scripts/PKGBUILD b/abs/core/runit-scripts/PKGBUILD
index 0c914f5..38adc5c 100755
--- a/abs/core/runit-scripts/PKGBUILD
+++ b/abs/core/runit-scripts/PKGBUILD
@@ -1,6 +1,6 @@
pkgname=runit-scripts
pkgver=2.1.1
-pkgrel=6
+pkgrel=7
pkgdesc="collection of startup scripts for runit"
url="http://smarden.org/runit/"
license="BSD"
diff --git a/abs/core/runit-scripts/runitscripts/services/nfs-common/finish b/abs/core/runit-scripts/runitscripts/services/nfs-common/finish
new file mode 100755
index 0000000..531192d
--- /dev/null
+++ b/abs/core/runit-scripts/runitscripts/services/nfs-common/finish
@@ -0,0 +1,51 @@
+#!/bin/bash
+exec 2>&1
+export TERM=linux
+daemon_name=nfs-common
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/$daemon_name.conf
+
+
+# rpc.statd daemon & binary location
+STATD_DAEMON_NAME=rpc.statd
+STATD="/usr/sbin/rpc.statd"
+
+# rpc.idmapd daemon & binary location
+IDMAPD_DAEMON_NAME=rpc.idmapd
+IDMAPD="/usr/sbin/rpc.idmapd"
+
+# rpc.gssd daemon & binary location
+GSSD_DAEMON_NAME=rpc.gssd
+GSSD="/usr/sbin/rpc.gssd"
+
+do_umount() {
+ if mountpoint -q "$1" ; then
+ umount "$1"
+ fi
+ return 0
+}
+
+get_pid() {
+ pidof -o %PPID "$1"
+}
+
+
+stat_runit "Stopping $GSSD_DAEMON_NAME daemon"
+PID=$(get_pid $GSSD)
+[ ! -z "$PID" ] && kill $PID &> /dev/null
+rm -f /var/run/$GSSD_DAEMON_NAME.pid &> /dev/null
+
+stat_runit "Stopping $IDMAPD_DAEMON_NAME daemon"
+PID=$(get_pid $IDMAPD)
+# KILL
+[ ! -z "$PID" ] && kill $PID &> /dev/null
+ rm -f /var/run/$IDMAPD_DAEMON_NAME.pid &> /dev/null
+do_umount "$PIPEFS_MOUNTPOINT" 2>/dev/null || true
+
+stat_runit "Stopping $STATD_DAEMON_NAME daemon"
+PID=$(get_pid $STATD)
+# KILL
+[ ! -z "$PID" ] && kill $PID &> /dev/null
+rm -f /var/run/$STATD_DAEMON_NAME.pid &> /dev/null
+
diff --git a/abs/core/runit-scripts/runitscripts/services/nfs-common/run b/abs/core/runit-scripts/runitscripts/services/nfs-common/run
new file mode 100755
index 0000000..bf6c2a1
--- /dev/null
+++ b/abs/core/runit-scripts/runitscripts/services/nfs-common/run
@@ -0,0 +1,81 @@
+#!/bin/bash
+exec 2>&1
+export TERM=linux
+daemon_name=nfs-common
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/$daemon_name.conf
+
+
+# rpc.statd daemon & binary location
+STATD_DAEMON_NAME=rpc.statd
+STATD="/usr/sbin/rpc.statd"
+
+# rpc.idmapd daemon & binary location
+IDMAPD_DAEMON_NAME=rpc.idmapd
+IDMAPD="/usr/sbin/rpc.idmapd"
+
+# rpc.gssd daemon & binary location
+GSSD_DAEMON_NAME=rpc.gssd
+GSSD="/usr/sbin/rpc.gssd"
+
+
+# Default mountpoint and options for rpc_pipefs filesystem
+[ -z "$PIPEFS_MOUNTPOINT" ] && PIPEFS_MOUNTPOINT="/var/lib/nfs/rpc_pipefs"
+[ -z "$PIPEFS_MOUNTOPTS" ] && PIPEFS_MOUNTOPTS="defaults"
+
+
+
+do_modprobe() {
+ if [ -x /sbin/modprobe -a -f /proc/modules ]; then
+ modprobe -q "$1" || true
+ fi
+}
+
+do_mount() {
+ if ! grep -E "$1\$" /proc/filesystems &> /dev/null ; then
+ return 1
+ fi
+
+ if grep -vw "$1" /proc/mounts &> /dev/null ; then
+ if ! mountpoint -q "$2" ; then
+ mount -t "$1" "$1" "$2" -o "$3"
+ return
+ fi
+ fi
+ return 0
+}
+
+do_umount() {
+ if mountpoint -q "$1" ; then
+ umount "$1"
+ fi
+ return 0
+}
+
+get_pid() {
+ pidof -o %PPID "$1"
+}
+
+
+
+
+
+
+stat_runit "Starting $daemon_name"
+svwaitup rpcbind >/dev/null 2>/dev/null
+/usr/sbin/sm-notify $SMNOTIFY_OPTS
+do_modprobe sunrpc
+do_modprobe nfs
+do_modprobe nfsd
+do_mount rpc_pipefs "$PIPEFS_MOUNTPOINT" "$PIPEFS_MOUNTOPTS"
+
+
+stat_runit "Starting $IDMAPD_DAEMON_NAME"
+$IDMAPD
+
+stat_runit "Starting $GSSD_DAEMON_NAME"
+do_modprobe rpcsec_gss_krb5
+$GSSD
+
+$STATD -F
diff --git a/abs/core/runit-scripts/runitscripts/services/nfsd/run b/abs/core/runit-scripts/runitscripts/services/nfsd/run
index 207d7cd..f043143 100755
--- a/abs/core/runit-scripts/runitscripts/services/nfsd/run
+++ b/abs/core/runit-scripts/runitscripts/services/nfsd/run
@@ -7,23 +7,64 @@ stat_runit "Starting NFSD"
# Make sure the statd daemon is up
# (the statd service must ensure portmap is running first)
-svwaitup /var/service/nfslock >/dev/null 2>/dev/null
+svwaitup /var/service/nfs-common >/dev/null 2>/dev/null
+
+source /etc/conf.d/nfs-server.conf
+
+NFSD="/usr/sbin/rpc.nfsd"
+
+
+
+# Default number of nfsd servers
+[ -z "$NFSD_COUNT" ] && NFSD_COUNT=8
+
+# Default mountpoint and options for nfsd filesystem
+[ -z "$PROCNFSD_MOUNTPOINT" ] && PROCNFSD_MOUNTPOINT="/proc/fs/nfsd"
+[ -z "$PROCNFSD_MOUNTOPTS" ] && PROCNFSD_MOUNTOPTS="rw,nodev,noexec,nosuid"
+
+do_modprobe() {
+ if [ -x /sbin/modprobe -a -f /proc/modules ]; then
+ modprobe -q "$1" || true
+ fi
+}
+
+
+
+do_mount() {
+ if ! grep -E "$1\$" /proc/filesystems &> /dev/null ; then
+ return 1
+ fi
+
+ if grep -vw "$1" /proc/mounts &> /dev/null ; then
+ if ! mountpoint -q "$2" ; then
+ mount -t "$1" "$1" "$2" -o "$3"
+ return
+ fi
+ fi
+ return 0
+}
+
+do_umount() {
+ if mountpoint -q "$1" ; then
+ umount "$1"
+ fi
+ return 0
+}
+
-source /etc/conf.d/nfs
-# Re-export all directories in /etc/exports
-/usr/sbin/exportfs -ra > /dev/null 2>/dev/null
# start some nfsd threads
printhl " Using ${NFSD_OPTS} "
-/usr/sbin/rpc.nfsd ${NFSD_OPTS} >/dev/null 2>/dev/null
+do_modprobe nfsd
+do_mount nfsd "$PROCNFSD_MOUNTPOINT" "$PROCNFSD_MOUNTOPTS"
+
+# Re-export all directories in /etc/exports
+/usr/sbin/exportfs -ra > /dev/null 2>/dev/null
-# since we are running kernel 2.6 we should also
-# mount the nfsd virtual filesystem
-printhl " mount nfsd"
-/bin/mount -t nfsd none /proc/fs/nfsd >/dev/null 2>/dev/null
+ $NFSD $NFSD_OPTS $NFSD_COUNT
-# Start the rpc.mountd daemon
-exec /usr/sbin/rpc.mountd --foreground >/dev/null 2>/dev/null
+#
+exec /usr/sbin/rpc.mountd --foreground >/dev/null 2>/dev/null
diff --git a/abs/core/runit-scripts/runitscripts/services/rpcbind/run b/abs/core/runit-scripts/runitscripts/services/rpcbind/run
new file mode 100755
index 0000000..86a961b
--- /dev/null
+++ b/abs/core/runit-scripts/runitscripts/services/rpcbind/run
@@ -0,0 +1,7 @@
+#!/bin/sh
+exec 2>&1
+export TERM=linux
+. /etc/rc.conf
+. /etc/rc.d/functions
+stat_runit "Starting rpc.bind"
+exec /usr/bin/rpcbind -d