Add PCICAP_{ID,NEXTPTR} to avoid using magic number
[dragonfly.git] / etc / rc.d / localdaemons
blobb19d98f6624958525951ba570972c22fe96fa765
1 #!/bin/sh
3 # $FreeBSD: src/etc/rc.d/localdaemons,v 1.2 2003/05/05 15:38:41 mtm Exp $
4 # $DragonFly: src/etc/rc.d/localdaemons,v 1.5 2005/12/30 21:01:49 dillon Exp $
7 # PROVIDE: localdaemons
8 # REQUIRE: abi
9 # BEFORE: securelevel
10 # KEYWORD: shutdown
12 . /etc/rc.subr
14 name="localdaemons"
15 start_cmd="locald_start"
16 stop_cmd="locald_stop"
18 # Returns true (0) if the passed argument is a valid name
19 # for a script, false (1) otherwise.
21 valid_scriptname()
23 case ${1##*.} in
24 orig)
25 return 1
27 sample)
28 return 1
30 dist)
31 return 1
33 esac
34 return 0
37 locald_start()
39 # For each dir in $local_startup, search for init scripts matching *
41 case ${local_startup} in
42 [Nn][Oo] | '')
45 echo -n 'Local package initialization:'
46 slist=""
47 if [ -z "${script_name_sep}" ]; then
48 script_name_sep=" "
50 for dir in ${local_startup}; do
51 if [ -d "${dir}" ]; then
52 for script in ${dir}/*; do
53 if valid_scriptname ${script}; then
54 slist="${slist}${script_name_sep}${script}"
56 done
58 done
59 script_save_sep="$IFS"
60 IFS="${script_name_sep}"
61 for script in ${slist}; do
62 if [ -x "${script}" ]; then
63 (set -T
64 trap 'exit 1' 2
65 ${script} start)
66 elif [ -f "${script}" -o -L "${script}" ]; then
67 echo -n " (skipping ${script##*/}, not executable)"
69 done
70 IFS="${script_save_sep}"
71 echo '.'
73 esac
76 locald_stop()
78 echo -n 'Shutting down daemon processes:'
80 # For each dir in $local_startup, search for init scripts matching *
81 case ${local_startup} in
82 [Nn][Oo] | '')
85 slist=""
86 if [ -z "${script_name_sep}" ]; then
87 script_name_sep=" "
89 for dir in ${local_startup}; do
90 if [ -d "${dir}" ]; then
91 for script in ${dir}/*; do
92 if valid_scriptname ${script}; then
93 slist="${slist}${script_name_sep}${script}"
95 done
97 done
98 script_save_sep="$IFS"
99 IFS="${script_name_sep}"
100 for script in `reverse_list ${slist}`; do
101 if [ -x "${script}" ]; then
102 (set -T
103 trap 'exit 1' 2
104 ${script} stop)
106 done
107 IFS="${script_save_sep}"
108 echo '.'
110 esac
113 load_rc_config $name
114 run_rc_command "$1"