summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authormtm <mtm@FreeBSD.org>2003-08-06 00:35:13 +0000
committermtm <mtm@FreeBSD.org>2003-08-06 00:35:13 +0000
commit8af048e8de093e695d0c236d4b7ce01ebbe0885b (patch)
treef5d4ead034afeee8e78dc7b4da9de8d9b03ac7e9 /etc
parent5dfa7ee632d0c80c07c607c80c1c64c54e21d713 (diff)
downloadFreeBSD-src-8af048e8de093e695d0c236d4b7ce01ebbe0885b.zip
FreeBSD-src-8af048e8de093e695d0c236d4b7ce01ebbe0885b.tar.gz
Rename localdaemons to localpkg.
The original name was really a mistake since /usr/local/etc/rc.d scripts can (and usually do) start more than just daemons. Even the output in the script uses 'local packages.' Also, the term 'local daemons' is used by rc.d/local, which was etc/rc.local of rcOG fame. No repo-copy because there isn't much history to save. I will remove localdaemons shortly with all the other files that don't belong in rc.d anymore. Discussed with: dougb, freebsd-rc@yahoogroups.com
Diffstat (limited to 'etc')
-rwxr-xr-xetc/rc.d/Makefile2
-rw-r--r--etc/rc.d/localdaemons2
-rw-r--r--etc/rc.d/localpkg90
-rw-r--r--etc/rc.d/netoptions2
4 files changed, 93 insertions, 3 deletions
diff --git a/etc/rc.d/Makefile b/etc/rc.d/Makefile
index d78a458..c1e4d74 100755
--- a/etc/rc.d/Makefile
+++ b/etc/rc.d/Makefile
@@ -19,7 +19,7 @@ FILES= DAEMON LOGIN NETWORKING SERVERS \
ipnat ipsec ipxrouted isdnd \
jail \
kadmind kerberos keyserv kldxref kpasswdd \
- ldconfig local localdaemons lomac lpd \
+ ldconfig local localdaemons localpkg lomac lpd \
motd mountcritlocal mountcritremote \
mountd moused mroute6d mrouted msgs \
named netif netoptions \
diff --git a/etc/rc.d/localdaemons b/etc/rc.d/localdaemons
index 9944975..dfd93f4 100644
--- a/etc/rc.d/localdaemons
+++ b/etc/rc.d/localdaemons
@@ -6,7 +6,7 @@
# PROVIDE: localdaemons
# REQUIRE: abi
# BEFORE: securelevel
-# KEYWORD: FreeBSD shutdown
+# KEYWORD: FreeBSD nostart
. /etc/rc.subr
diff --git a/etc/rc.d/localpkg b/etc/rc.d/localpkg
new file mode 100644
index 0000000..add28fe
--- /dev/null
+++ b/etc/rc.d/localpkg
@@ -0,0 +1,90 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: localpkg
+# REQUIRE: abi
+# BEFORE: securelevel
+# KEYWORD: FreeBSD 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:'
+ slist=""
+ if [ -z "${script_name_sep}" ]; then
+ script_name_sep=" "
+ fi
+ for dir in ${local_startup}; do
+ if [ -d "${dir}" ]; then
+ for script in ${dir}/*.sh; do
+ slist="${slist}${script_name_sep}${script}"
+ done
+ fi
+ done
+ script_save_sep="$IFS"
+ IFS="${script_name_sep}"
+ for script in ${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
+ IFS="${script_save_sep}"
+ echo '.'
+ ;;
+ esac
+}
+
+pkg_stop()
+{
+ echo -n 'Shutting down daemon processes:'
+
+ # For each dir in $local_startup, search for init scripts matching *.sh
+ case ${local_startup} in
+ [Nn][Oo] | '')
+ ;;
+ *)
+ slist=""
+ if [ -z "${script_name_sep}" ]; then
+ script_name_sep=" "
+ fi
+ for dir in ${local_startup}; do
+ if [ -d "${dir}" ]; then
+ for script in ${dir}/*.sh; do
+ slist="${slist}${script_name_sep}${script}"
+ done
+ fi
+ done
+ script_save_sep="$IFS"
+ IFS="${script_name_sep}"
+ for script in `reverse_list ${slist}`; do
+ if [ -x "${script}" ]; then
+ (set -T
+ trap 'exit 1' 2
+ ${script} stop)
+ fi
+ done
+ IFS="${script_save_sep}"
+ echo '.'
+ ;;
+ esac
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/netoptions b/etc/rc.d/netoptions
index da773c9..8a6df5e 100644
--- a/etc/rc.d/netoptions
+++ b/etc/rc.d/netoptions
@@ -4,7 +4,7 @@
#
# PROVIDE: netoptions
-# REQUIRE: localdaemons
+# REQUIRE: localpkg
# BEFORE: securelevel
# KEYWORD: FreeBSD
OpenPOWER on IntegriCloud