Date: Mon, 6 Jun 2005 23:35:36 -0400 From: "J.R. Oldroyd" <jr@opal.com> To: Brooks Davis <brooks@one-eyed-alien.net> Cc: freebsd-rc@freebsd.org, "J.R. Oldroyd" <fbsd@opal.com> Subject: Re: Use of rcorder for local rc.d/*.sh scripts Message-ID: <20050607033536.GH37208@linwhf.opal.com> In-Reply-To: <20050607003142.GD10526@odin.ac.hmc.edu> References: <20050603143803.GP886@linwhf.opal.com> <42A4CA37.1050201@FreeBSD.org> <20050606235426.GA10526@odin.ac.hmc.edu> <20050607001447.GG37208@linwhf.opal.com> <20050607003142.GD10526@odin.ac.hmc.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
--Y7xTucakfITjPcLV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Jun 06, 17:31, Brooks Davis wrote: >=20 > I think your original suggestion is the direction we should take. > Things that truly need to run before or after localpkg can be handled by > an existing ports mechanism. >=20 OK, well, below is probably a more complete patch. I've added the shutdown part, and copied the "-k shutdown" option and the "-s nojail" option from /etc/rc and /etc/rc.shutdown. The code to handle file names with embedded spaces using the IFS change is not actually needed if the shell patterns to match the filenames are expanded in the for loop which executes the scripts. So this patch removes all that code. Note that the matching of "*.sh" is what the script does now. I've not changed that. If we want to remove the requirement that scripts in the local_startup dirs be named *.sh, this code can be simplified even further. -jr --- /etc/rc.d/localpkg.orig Fri Oct 8 13:52:43 2004 +++ /etc/rc.d/localpkg Mon Jun 6 23:25:47 2005 @@ -14,6 +14,9 @@ start_cmd=3D"pkg_start" stop_cmd=3D"pkg_stop" =20 +rcorder_opts=3D"" +[ `/sbin/sysctl -n security.jail.jailed` -eq 1 ] && rcorder_opts=3D"-s noj= ail" + pkg_start() { # For each dir in $local_startup, search for init scripts matching *.sh @@ -24,19 +27,12 @@ *) echo -n 'Local package initialization:' slist=3D"" - if [ -z "${script_name_sep}" ]; then - script_name_sep=3D" " - fi for dir in ${local_startup}; do if [ -d "${dir}" ]; then - for script in ${dir}/*.sh; do - slist=3D"${slist}${script_name_sep}${script}" - done + slist=3D"${slist} ${dir}/*.sh" fi done - script_save_sep=3D"$IFS" - IFS=3D"${script_name_sep}" - for script in ${slist}; do + for script in `rcorder -s nostart ${rcorder_opts} ${slist} 2>/dev/null`;= do if [ -x "${script}" ]; then (set -T trap 'exit 1' 2 @@ -45,7 +41,6 @@ echo -n " (skipping ${script##*/}, not executable)" fi done - IFS=3D"${script_save_sep}" echo '.' ;; esac @@ -61,26 +56,18 @@ ;; *) slist=3D"" - if [ -z "${script_name_sep}" ]; then - script_name_sep=3D" " - fi for dir in ${local_startup}; do if [ -d "${dir}" ]; then - for script in ${dir}/*.sh; do - slist=3D"${slist}${script_name_sep}${script}" - done + slist=3D"${slist} ${dir}/*.sh" fi done - script_save_sep=3D"$IFS" - IFS=3D"${script_name_sep}" - for script in `reverse_list ${slist}`; do + for script in `reverse_list \`rcorder -k shutdown ${rcorder_opts} ${slis= t} 2>/dev/null\``; do if [ -x "${script}" ]; then (set -T trap 'exit 1' 2 ${script} stop) fi done - IFS=3D"${script_save_sep}" echo '.' ;; esac --Y7xTucakfITjPcLV Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (FreeBSD) iQDVAwUBQqUWCEkkqUax7f6FAQKXKQX9HuoVmwQZ3zHR2d3ghjwsKafyyvQZy/Y1 PDTAD5AnO5ccPcsmiCYXRGfLs04zg4hnx/Wb35fdFSmSLSxI+Dl9NHV4tKIzYsn/ Sw6ihXVWMAGU5kDgY6Tq32onTcaHpv+fcgss1H6Vqy0k7PUOA/HtzuZgZmq1u+Es ryu3+sPkKt6wK8RdBZ4XY2stEIxvYzkO6RMOvGyOE//5CSX24MEc1MEHHgqMPNkb t4v4PV52p08tAzbxtJqc1z2IgTSsAqz0 =DuN3 -----END PGP SIGNATURE----- --Y7xTucakfITjPcLV--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050607033536.GH37208>