Subject: bin/17807: directory handling bugfix for /sbin/newbtconf
To: None <gnats-bugs@gnats.netbsd.org>
From: Stoned Elipot <seb@script.jussieu.fr>
List: netbsd-bugs
Date: 08/02/2002 12:16:49
>Number:         17807
>Category:       bin
>Synopsis:       directory handling bugfix for /sbin/newbtconf
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 02 03:17:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Stoned Elipot
>Release:        -current
>Organization:
SCRIPT, Paris VII University, France
>Environment:
System: NetBSD runabout 1.6D NetBSD 1.6D (RUNABOUT) #0: Fri Jul 12 00:18:29 UTC 2002     root@runabout:/usr/u/seb/src/RUNABOUT/compile i386


>Description:
/etc/rc.conf.d is part of the FILES variable value in /sbin/newbtconf
so it appeared to me that it was intended that this directory be handle
by the multiple configuration scheme newbtconf and /etc/rc.d/bootconf.sh
provide. Unfortunately the code of the initialisation step do not
handle directories only regular files.

And then the code for creation a new configuration can not handle directories
as well.
>How-To-Repeat:
Run '/sbin/newbtconf init' and observe that /etc/rc.conf.d is left untouched
i.e. it is not moved to /etc/etc.network and a symlink to etc.current/rc.conf.d
is not created.
>Fix:
The following patch should fix this problem.

Index: newbtconf.sh
===================================================================
RCS file: /cvsroot/basesrc/sbin/newbtconf/newbtconf.sh,v
retrieving revision 1.5
diff -u -r1.5 newbtconf.sh
--- newbtconf.sh	2001/11/18 03:50:53	1.5
+++ newbtconf.sh	2002/08/02 10:08:14
@@ -24,7 +24,7 @@
 	ln -s $dir etc.current
 	ln -s $dir etc.default
 	for i in ${FILES}; do
-		if [ -f $i ] ; then
+		if [ -f $i -o -d $i ] ; then
 			mv $i $dir
 			ln -s etc.current/$i .
 		fi
@@ -57,6 +57,7 @@
 	exit 1;
 fi
 mkdir -m 755 /etc/$dir
-cp -p /etc/$orig/* /etc/$dir
+cd /etc/$orig 
+pax -rw -pe . /etc/$dir
 echo "/etc/$dir has now been created and populated."
 exit 0
>Release-Note:
>Audit-Trail:
>Unformatted: