From jeremyp@gsmx07.alcatel.com.au Wed Aug  4 15:47:36 1999
Return-Path: <jeremyp@gsmx07.alcatel.com.au>
Received: from alcanet.com.au (border.alcanet.com.au [203.62.196.10])
	by hub.freebsd.org (Postfix) with ESMTP id 21B4B14D7D
	for <FreeBSD-gnats-submit@FreeBSD.ORG>; Wed,  4 Aug 1999 15:46:57 -0700 (PDT)
	(envelope-from jeremyp@gsmx07.alcatel.com.au)
Received: by border.alcanet.com.au id <40331>; Thu, 5 Aug 1999 08:27:11 +1000
Message-Id: <99Aug5.082711est.40331@border.alcanet.com.au>
Date: Thu, 5 Aug 1999 08:46:32 +1000
From: Peter Jeremy <jeremyp@gsmx07.alcatel.com.au>
Reply-To: peter.jeremy@alcatel.com.au
To: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: No backup init(8) kept during installworld
X-Send-Pr-Version: 3.2

>Number:         12976
>Category:       bin
>Synopsis:       No backup init(8) kept during installworld
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug  4 15:50:01 PDT 1999
>Closed-Date:    Thu Aug 5 02:14:31 PDT 1999
>Last-Modified:  Thu Aug  5 02:16:41 PDT 1999
>Originator:     Peter Jeremy
>Release:        FreeBSD 4.0-CURRENT i386
>Organization:
Alcatel Australia Limited
>Environment:

	cvs-cur 5539

>Description:

	init(8) is a critical part of the system startup - if no
	suitable init can be found, the kernel will panic.  It's
	also the only critical file which is automatically updated
	during an installworld without any backup being kept.

	When a new kernel is installed, the current kernel is kept as
	/kernel.old.  Similarly, the old /boot/loader is kept as
	/boot/loader.old.  Whilst /bin/sh is not backed up, /bin/csh
	and /stand/sh (the latter is unaffected by installworld) are
	available as alternatives.  [If wanted, something very similar
	to the patch below should also apply to /src/bin/sh/Makefile].

	During startup, the kernel will scan a range of pathnames
	(/sbin/init, /sbin/oinit, /sbin/init.bak, /stand/sysinstall
	by default), and this can be over-ridden from /boot/loader
	with the init_path environment variable.

	It therefore seems reasonable to save the existing (working)
	init in case the new one is faulty in some way.

>How-To-Repeat:

	Code inspection.
	cd .../src/sbin/init; make install

>Fix:
	
Index: Makefile
===================================================================
RCS file: /home/CVSROOT/./src/sbin/init/Makefile,v
retrieving revision 1.17
diff -u -r1.17 Makefile
--- Makefile	1999/07/01 13:33:56	1.17
+++ Makefile	1999/08/04 22:22:54
@@ -33,3 +33,10 @@
 .endif
 
 .endif
+
+# Backup existing /sbin/init as /sbin/oinit in case the new one blows up
+.if exists(${DESTDIR}${BINDIR}/${PROG})
+beforeinstall:
+	-chflags noschg ${DESTDIR}${BINDIR}/${PROG}
+	mv ${DESTDIR}${BINDIR}/${PROG} ${DESTDIR}${BINDIR}/o${PROG}
+.endif

--
Peter Jeremy (VK2PJ)                    peter.jeremy@alcatel.com.au
Alcatel Australia Limited
41 Mandible St                          Phone: +61 2 9690 5019
ALEXANDRIA  NSW  2015                   Fax:   +61 2 9690 5982

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: ru 
State-Changed-When: Thu Aug 5 02:14:31 PDT 1999 
State-Changed-Why:  
Committed, thanks! 
>Unformatted:
