Lines 1-5
Link Here
|
1 |
# $NetBSD: rc.subr,v 1.67 2006/10/07 11:25:15 elad Exp $ |
1 |
# $NetBSD: rc.subr,v 1.67 2006/10/07 11:25:15 elad Exp $ |
2 |
# $FreeBSD$ |
2 |
# $FreeBSD: release/10.0.0/etc/rc.subr 256256 2013-10-10 09:32:27Z hrs $ |
3 |
# |
3 |
# |
4 |
# Copyright (c) 1997-2004 The NetBSD Foundation, Inc. |
4 |
# Copyright (c) 1997-2004 The NetBSD Foundation, Inc. |
5 |
# All rights reserved. |
5 |
# All rights reserved. |
Lines 49-54
Link Here
|
49 |
IDCMD="if [ -x $ID ]; then $ID -un; fi" |
49 |
IDCMD="if [ -x $ID ]; then $ID -un; fi" |
50 |
PS="/bin/ps -ww" |
50 |
PS="/bin/ps -ww" |
51 |
JID=`$PS -p $$ -o jid=` |
51 |
JID=`$PS -p $$ -o jid=` |
|
|
52 |
SET_CLASS="/usr/sbin/setloginclass" |
53 |
PMAC="$([ -x "$SET_CLASS" ] && [ -x /usr/sbin/getpmac ] && /usr/sbin/getpmac 2> /dev/null)" |
54 |
[ -n "$PMAC" ] && SET_CLASS="$SET_CLASS -m" |
55 |
RC_EXEMPT="/etc/rc.exempt" |
56 |
RC_EXEMPT="$([ -f "$RC_EXEMPT" ] && [ -r "$RC_EXEMPT" ] && \ |
57 |
/usr/bin/stat -f%Lp,%u,%g "$RC_EXEMPT" 2> /dev/null | \ |
58 |
/usr/bin/grep -q '0,0,0$' && echo "$RC_EXEMPT")" |
59 |
EXEMPT_CLASS="default" |
60 |
DAEMON_CLASS="daemon" |
61 |
EXEMPT_CMD="check_exempt" |
62 |
|
63 |
check_exempt() |
64 |
{ |
65 |
if ! /usr/bin/grep -Eq "^$1(:|$)" "$2"; then |
66 |
echo "$DAEMON_CLASS" |
67 |
else |
68 |
class=$(/usr/bin/grep -E "$1(:|$)" "$2" | /usr/bin/cut -d: -f2 -s) |
69 |
[ -n "$class" ] && echo "$class" || echo "$EXEMPT_CLASS" |
70 |
fi |
71 |
} |
52 |
|
72 |
|
53 |
# |
73 |
# |
54 |
# functions |
74 |
# functions |
Lines 997-1003
Link Here
|
997 |
;; |
1017 |
;; |
998 |
*) # run in subshell |
1018 |
*) # run in subshell |
999 |
if [ -x $_file ]; then |
1019 |
if [ -x $_file ]; then |
1000 |
if [ -n "$rc_fast_and_loose" ]; then |
1020 |
if [ -n "$SET_CLASS" ]; then |
|
|
1021 |
unset class |
1022 |
if [ -n "$RC_EXEMPT" ] && [ -n "$EXEMPT_CMD" ]; then |
1023 |
class=$($EXEMPT_CMD "$_file" "$RC_EXEMPT" 2> /dev/null) |
1024 |
fi |
1025 |
[ -n "$class" ] || class=$DAEMON_CLASS |
1026 |
( |
1027 |
set -a |
1028 |
eval "$(set)" |
1029 |
unset _rc_subr_loaded |
1030 |
$SET_CLASS "$class" $_file $_arg |
1031 |
) |
1032 |
elif [ -n "$rc_fast_and_loose" ]; then |
1001 |
set $_arg; . $_file |
1033 |
set $_arg; . $_file |
1002 |
else |
1034 |
else |
1003 |
( trap "echo Script $_file interrupted >&2 ; kill -QUIT $$" 3 |
1035 |
( trap "echo Script $_file interrupted >&2 ; kill -QUIT $$" 3 |