Use of rcorder for local rc.d/*.sh scripts
J.R. Oldroyd
fbsd at opal.com
Thu Jun 9 00:35:14 GMT 2005
On Jun 08, 16:38, Brooks Davis wrote:
>
> What I like about the localpkg hack is that it doesn't change much. I
> think you have solutions to most of my concerns though. My gut feeling
> is that full integration of /usr/local in rcorder is not feasible for
> 6.0, but localpkg with rcorder should be. Remember, feature freeze is
> nominally Friday. My suggestion would be to push for the localpkg hack
> and the port changes it requires for 6.0 so ports can depend on
> each other's services with the plan of doing full integration in 7.0.
> That would get the most critical feature working now and give us over a
> year to shake out any issues with full ordering. After a good period of
> settling, I think we could even MFC the localpkg hack to 5.x, probably in
> time for 5.5. If that, happened, I think we'd be able to fully mandate
> rc.d style scripts for 7.0 because all supported versions of FreeBSD
> would run rcorder on their scripts.
>
I have yet another diff to localpkg, this one explicitly creates
two lists, one for [^0-9]*.sh files and the other for [0-9]*.sh files.
It then uses rcorder to sort the non-numeric-named ones, prepends
the numeric-named ones and runs them. This retains existing
000.foo.sh functionality and makes it, I believe, so that no port
changes are needed! It's below.
OK, so what needs to be done next in terms of "push[ing] for the localpkg
hack and the port changes it requires" before Friday? To whom should
I send this?
> BTW, thanks for working on this. It's a feature I've been wanting for
> some time now. As always the devil is the details.
>
You're welcome.
-jr
--- /etc/rc.d/localpkg.orig Fri Oct 8 13:52:43 2004
+++ /etc/rc.d/localpkg Tue Jun 7 15:19:19 2005
@@ -14,6 +14,9 @@
start_cmd="pkg_start"
stop_cmd="pkg_stop"
+rcorder_opts=""
+[ `/sbin/sysctl -n security.jail.jailed` -eq 1 ] && rcorder_opts="-s nojail"
+
pkg_start()
{
# For each dir in $local_startup, search for init scripts matching *.sh
@@ -24,19 +27,14 @@
*)
echo -n 'Local package initialization:'
slist=""
- if [ -z "${script_name_sep}" ]; then
- script_name_sep=" "
- fi
+ zlist=""
for dir in ${local_startup}; do
if [ -d "${dir}" ]; then
- for script in ${dir}/*.sh; do
- slist="${slist}${script_name_sep}${script}"
- done
+ slist="${slist} ${dir}/[^0-9]*.sh"
+ zlist="${zlist} ${dir}/[0-9]*.sh"
fi
done
- script_save_sep="$IFS"
- IFS="${script_name_sep}"
- for script in ${slist}; do
+ for script in ${zlist} `rcorder -s nostart ${rcorder_opts} ${slist} 2>/dev/null`; do
if [ -x "${script}" ]; then
(set -T
trap 'exit 1' 2
@@ -45,7 +43,6 @@
echo -n " (skipping ${script##*/}, not executable)"
fi
done
- IFS="${script_save_sep}"
echo '.'
;;
esac
@@ -61,26 +58,20 @@
;;
*)
slist=""
- if [ -z "${script_name_sep}" ]; then
- script_name_sep=" "
- fi
+ zlist=""
for dir in ${local_startup}; do
if [ -d "${dir}" ]; then
- for script in ${dir}/*.sh; do
- slist="${slist}${script_name_sep}${script}"
- done
+ slist="${slist} ${dir}/[^0-9]*.sh"
+ zlist="${zlist} ${dir}/[0-9]*.sh"
fi
done
- script_save_sep="$IFS"
- IFS="${script_name_sep}"
- for script in `reverse_list ${slist}`; do
+ for script in `reverse_list ${zlist} \`rcorder -k shutdown ${rcorder_opts} ${slist} 2>/dev/null\``; do
if [ -x "${script}" ]; then
(set -T
trap 'exit 1' 2
${script} stop)
fi
done
- IFS="${script_save_sep}"
echo '.'
;;
esac
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 390 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-rc/attachments/20050608/e6eea38b/attachment.bin
More information about the freebsd-rc
mailing list