2016-05-18 11:44:03 +03:00
|
|
|
#!/sbin/openrc-run
|
2019-08-13 13:21:57 +03:00
|
|
|
# Copyright 1999-2019 Gentoo Authors
|
2011-11-09 11:33:19 +04:00
|
|
|
# Distributed under the terms of the GNU General Public License v2
|
|
|
|
|
|
|
|
DAEMON=/usr/sbin/automount
|
|
|
|
PIDFILE=/var/run/autofs.pid
|
|
|
|
DEVICE=autofs
|
|
|
|
|
|
|
|
depend() {
|
|
|
|
need localmount
|
2019-08-13 13:21:57 +03:00
|
|
|
use ypbind nfsclient slapd net
|
2011-11-09 11:33:19 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2013-11-11 10:37:27 +04:00
|
|
|
kill -s HUP $(cat "${PIDFILE}") 2> /dev/null
|
2011-11-09 11:33:19 +04:00
|
|
|
eend $?
|
|
|
|
fi
|
|
|
|
}
|