From 7385c6143c1b587bca68deade6e5989d11879767 Mon Sep 17 00:00:00 2001 From: freaj Date: Mon, 30 Mar 2015 10:36:00 +0200 Subject: openrc-net-20150330-1: updating version --- pcr/openrc-net/autofs5.initd | 70 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 pcr/openrc-net/autofs5.initd (limited to 'pcr/openrc-net/autofs5.initd') diff --git a/pcr/openrc-net/autofs5.initd b/pcr/openrc-net/autofs5.initd new file mode 100644 index 000000000..939444e02 --- /dev/null +++ b/pcr/openrc-net/autofs5.initd @@ -0,0 +1,70 @@ +#!/sbin/runscript +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/autofs/files/autofs5.initd,v 1.4 2013/11/10 15:53:29 tomwij Exp $ + +DAEMON=/usr/sbin/automount +PIDFILE=/var/run/autofs.pid +DEVICE=autofs + +depend() { + need localmount + use ypbind nfs slapd portmap net +} + +extra_started_commands="reload" + +start() { + ebegin "Starting automounter" + + # Ensure autofs support is loaded + grep -q autofs /proc/filesystems || modprobe -q autofs4 + if [ $? -ne 0 ]; then + eend 1 "No autofs support available in kernel" + return 1 + fi + + # Check misc device + if [ -n "${USE_MISC_DEVICE}" -a "${USE_MISC_DEVICE}" = "yes" ]; then + sleep 1 + if [ -e "/proc/misc" ]; then + MINOR=$(awk "/${DEVICE}/ {print \$1}" /proc/misc) + if [ -n "${MINOR}" -a ! -c "/dev/${DEVICE}" ]; then + mknod -m 0600 "/dev/${DEVICE}" c 10 ${MINOR} + if [ $? -ne 0 ]; then + eend 1 "Could not create '/dev/${DEVICE}'" + return 1 + fi + fi + fi + if [ -x /sbin/restorecon -a -c "/dev/${DEVICE}" ]; then + /sbin/restorecon "/dev/${DEVICE}" + if [ $? -ne 0 ]; then + eend 1 "Failed to execute '/sbin/restorecon \"/dev/${DEVICE}\"'" + return 1 + fi + fi + else + [ -c "/dev/${DEVICE}" ] && rm -rf "/dev/${DEVICE}" + fi + + start-stop-daemon --start --exec ${DAEMON} -- -p ${PIDFILE} ${OPTIONS} + + eend $? +} + +stop() { + ebegin "Stopping automounter" + start-stop-daemon --stop --quiet -R TERM/45 -p ${PIDFILE} + eend $? +} + +reload() { + ebegin "Reloading automounter" + if [ ! -r "${PIDFILE}" ]; then + eend 1 "automount not running" + else + kill -s HUP $(cat "${PIDFILE}") 2> /dev/null + eend $? + fi +} -- cgit v1.2.3-2-g168b