tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: service(8): post commit feedback solicited
Matthew
On Wed, Mar 25, 2015 at 03:01:58PM -0400, matthew sporleder wrote:
> The following patch will make this work on older NetBSD and will also figure out
> if something is using /etc/rc.conf.d, which your version does not:
good catch!
I see, ls -P is missing pre -7; I'd prefer to avoid awk and be defensive
with load_rc_config as it throws errors when no arg is passed.
How about the attached patch?
Adrian
? service_with_rc_conf_d.patch
Index: service
===================================================================
RCS file: /cvsroot/src/usr.sbin/service/service,v
retrieving revision 1.4
diff -u -r1.4 service
--- service 23 Mar 2015 23:28:55 -0000 1.4
+++ service 25 Mar 2015 21:59:54 -0000
@@ -46,9 +46,11 @@
rc_files()
{
- local dir
- for dir in ${rc_directories}; do
- [ -d ${dir} ] && ls -P1 ${dir} 2>/dev/null
+ local d f
+ for d in ${rc_directories}; do
+ if [ -d $d ]; then
+ (cd $d && ls | while read f; do echo "$d/$f"; done) 2>/dev/null
+ fi
done | xargs rcorder -s nostart ${rc_rcorder_flags} 2>/dev/null
return 0
}
@@ -80,7 +82,10 @@
if grep -q ^rcvar $file; then
eval $( grep ^name= $file )
eval $( grep ^rcvar $file )
- checkyesno ${rcvar} 2>/dev/null && echo ${file}
+ if [ -n "${rcvar}" ]; then
+ load_rc_config "${rcvar}"
+ checkyesno ${rcvar} 2>/dev/null && echo ${file}
+ fi
fi
done
exit 0
Home |
Main Index |
Thread Index |
Old Index