NetBSD-Bugs archive

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

misc/46601: add support for rc_directories to rc.shutdown



>Number:         46601
>Category:       misc
>Synopsis:       rc does, but rc.shutdown does not, support rc_directories
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 15 03:15:00 +0000 2012
>Originator:     Jim Bernard
>Release:        NetBSD 6.99.7
>Organization:
self
>Environment:
System: NetBSD 6.99.7 #0: Wed Jun 13 19:59:26 MDT 2012 i386
Architecture: i386
Machine: i386
>Description:
        Some time ago, /etc/rc acquired support for multiple directories
        containing rc.d scripts, specified in the rc.conf variable
        rc_directories.  The same need exists in rc.shutdown, but
        the feature was not added to it.

>How-To-Repeat:
        Have startup scripts in /usr/pkg/etc/rc.d or some other
        location besides /etc/rc.d and run shutdown.  Note that
        none of the scripts in alternative directories is executed.
        Or compare the rc and rc.shutdown scripts in the vicinity
        of the invocation of rcorder.

>Fix:
        Just augment /etc/rc.shutdown in the same way that /etc/rc
        was long ago:

--- rc.shutdown-dist    2012-06-13 16:37:03.000000000 -0600
+++ rc.shutdown 2012-06-14 20:44:11.000000000 -0600
@@ -42,14 +42,16 @@
            ) &
        _rcshutdown_watchdog=$!
 fi
 
 
-#      Determine the shutdown order of the /etc/rc.d scripts,
+#      Determine the shutdown order of the rc.d scripts,
 #      and perform the operation
 #
-files=$(rcorder -k shutdown ${rcshutdown_rcorder_flags} /etc/rc.d/*)
+scripts=$(for rcd in ${rc_directories:-/etc/rc.d}; do
+       test -d ${rcd} && echo ${rcd}/*; done)
+files=$(rcorder -k shutdown ${rcshutdown_rcorder_flags} ${scripts})
 
 for _rc_elem in $(reverse_list $files); do
        run_rc_script $_rc_elem stop
 done
 



Home | Main Index | Thread Index | Old Index