freebsd-dev/etc/rc.d/localpkg
Doug Barton 0f3ce2b32c Introduce startup scripts from the local_startup directories to
the base rcorder. This is accomplished by running rcorder twice,
first to get all the disks mounted (through mountcritremote),
then again to include the local_startup directories.

This dramatically changes the behavior of rc.d/localpkg, as
all "local" scripts that have the new rc.d semantics are now
run in the base rcorder, so only scripts that have not been
converted yet will run in rc.d/localpkg.

Make a similar change in rc.shutdown, and add some functions in
rc.subr to support these changes.

Bump __FreeBSD_version to reflect this change.
2005-12-02 20:06:07 +00:00

63 lines
1000 B
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: localpkg
# REQUIRE: abi
# BEFORE: securelevel
# KEYWORD: shutdown
. /etc/rc.subr
name="localpkg"
start_cmd="pkg_start"
stop_cmd="pkg_stop"
pkg_start()
{
# For each dir in $local_startup, search for init scripts matching *.sh
#
case ${local_startup} in
[Nn][Oo] | '')
;;
*)
echo -n 'Local package initialization:'
find_local_scripts_old
for script in ${zlist} ${slist}; do
if [ -x "${script}" ]; then
(set -T
trap 'exit 1' 2
${script} start)
elif [ -f "${script}" -o -L "${script}" ]; then
echo -n " (skipping ${script}, not executable)"
fi
done
echo '.'
;;
esac
}
pkg_stop()
{
case ${local_startup} in
[Nn][Oo] | '')
;;
*)
echo -n 'Shutting down daemon processes:'
find_local_scripts_old
for script in `reverse_list ${slist} ${zlist}`; do
if [ -x "${script}" ]; then
(set -T
trap 'exit 1' 2
${script} stop)
fi
done
echo '.'
;;
esac
}
load_rc_config $name
run_rc_command "$1"