tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: service(8): post commit feedback solicited



On Wed, Mar 25, 2015 at 11:36 AM, Adrian Steinmann <ast%marabu.ch@localhost> wrote:
> On Wed, Mar 25, 2015 at 09:56:26AM -0400, matthew sporleder wrote:
>> On Mon, Mar 23, 2015 at 4:26 PM, Adrian Steinmann <ast%netbsd.org@localhost> wrote:
> ... service(8) manpage elided ...
>> Is this supposed to work on -6?
> Well I didn't test it on -6, neither did I request a pullup-6 (but a pullup-7, where it works unchanged).
>
>> I can't seem to produce any output.
> I could imagine that $rc_directories is not defined in /etc/defaults/rc.conf:
>
> rc_directories=/etc/rc.d
>
> should be there.
>
> If it's not (I don't have access to a -6 machine ATM), try putting that line into your /etc/rc.conf or:
>
> [ -z "rc_directories" ] && rc_directories=/etc/rc.d
>
> right after the getopts in the service script itself.
>
> If that doesn't work, send me a
>
> sh -x services -ev >services_out_err_on_6 2>&1
>
> output under private email.
>
> Thanks
> Adrian
>
> PS. This doesn't mean I intend to pullup-6, but it'd be nice to have it work anyways.


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:

~ $ diff -u service-orig service
--- service-orig        2015-03-25 14:10:18.000000000 -0400
+++ service     2015-03-25 15:00:23.000000000 -0400
@@ -44,11 +44,17 @@
     exit 1
 }

+lsP1()
+{
+    dir=$*;
+    ls -1 "${dir}"|awk -vDIR="${dir}" '{ print DIR"/"$0; }'
+}
+
 rc_files()
 {
     local dir
     for dir in ${rc_directories}; do
-        [ -d ${dir} ] && ls -P1 ${dir} 2>/dev/null
+        [ -d ${dir} ] && lsP1 ${dir} 2>/dev/null
     done | xargs rcorder -s nostart ${rc_rcorder_flags} 2>/dev/null
     return 0
 }
@@ -80,6 +86,7 @@
         if grep -q ^rcvar $file; then
             eval $( grep ^name= $file )
             eval $( grep ^rcvar $file )
+            load_rc_config "${rcvar}"
             checkyesno ${rcvar} 2>/dev/null && echo ${file}
         fi
     done


Home | Main Index | Thread Index | Old Index