Subject: bin/17808: /sbin/newbtconf new feature
To: None <gnats-bugs@gnats.netbsd.org>
From: Stoned Elipot <seb@script.jussieu.fr>
List: netbsd-bugs
Date: 08/02/2002 12:26:57
>Number:         17808
>Category:       bin
>Synopsis:       /sbin/newbtconf new feature
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 02 03:27: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:
I find useful to be able to easily to "unlink" the symbolic links created
by 'newbtconf init' and restore as actual files (or directories hint hint :)
the currently selected configuration bits.

I added an new mode of operation for newbtconf to provide this functionality.
>How-To-Repeat:
>Fix:
The following patch implements the proposed feature.

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:15:22
@@ -5,6 +5,7 @@
 if [ $# -lt 1 ] ; then
 	echo "Usage: $0 <newconfig> [<baseconfig>]"
 	echo "Usage: $0 init"
+	echo "Usage: $0 unlink"
 	exit 1;
 fi
 dir=$1
@@ -30,6 +31,42 @@
 		fi
 	done
 	echo "/etc/$dir has now been created and populated."
+	exit 0
+fi
+
+if [ $dir = unlink ] ; then
+	if [ !  -d /etc/etc.current ] ; then
+		echo "Error: multi-configuration not initialized"
+		exit 1
+	fi
+	cd /etc
+	for i in ${FILES}; do
+		if [ -f $i ] ; then
+			stat="`ls -ld $i`"
+			case x"$stat" in
+				xl*) :;;
+				x*)
+				echo "$i: not a symlink, skipping"
+				continue ;;	
+			esac
+			linkto="${stat##*-> }"
+			case x"$linkto" in
+				xetc.current/*) :;;
+				x*)
+				echo "$i: does not symlink to etc.current, skipping"
+				continue ;;
+			esac
+			if [ -f $i ] ; then
+				rm $i
+				cp -p $linkto $i
+			else
+				rm $i
+				( cd etc.current && pax -rw -pe $i /etc )
+			fi
+		fi
+	done
+	rm etc.current
+	rm etc.default
 	exit 0
 fi
 
Index: newbtconf.8
===================================================================
RCS file: /cvsroot/basesrc/sbin/newbtconf/newbtconf.8,v
retrieving revision 1.8
diff -u -r1.8 newbtconf.8
--- newbtconf.8	2002/02/08 01:30:45	1.8
+++ newbtconf.8	2002/08/02 10:15:23
@@ -189,6 +189,21 @@
 Other actions such as deleting any NFS mounts from
 .Pa /etc/etc.nonet/fstab
 would also need to be undertaken.
+.Ss Stopping using multiple boot configurations
+Multiple boot configurations can be deactivated by invoking
+.Nm
+with an argument of
+.Sq unlink .
+All the symlinks mentioned above are then removed and the files they point to
+are copied to their default place. This effectively make the currently selected
+configuration the only one active. The symbolic links 
+.Pa /etc/etc.current
+and
+.Pa /etc/etc.default
+are also removed so upon rebooting no configuration selection menu is 
+displayed. Note that the previously created configurations (in 
+.Pa /etc/etc.\*[Lt]name\*[Gt] )
+are not removed.
 .El
 .Sh FILES
 .Bl -tag -width /etc/mrouted.current -compact
>Release-Note:
>Audit-Trail:
>Unformatted: