From joelh@thor.piquan.org  Sun Dec 14 21:46:58 2003
Return-Path: <joelh@thor.piquan.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 2151616A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 14 Dec 2003 21:46:58 -0800 (PST)
Received: from thor.piquan.org (adsl-66-125-235-59.dsl.sntc01.pacbell.net [66.125.235.59])
	by mx1.FreeBSD.org (Postfix) with ESMTP id BBCDA43D1F
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 14 Dec 2003 21:46:55 -0800 (PST)
	(envelope-from joelh@thor.piquan.org)
Received: from thor.piquan.org (joelh@localhost [127.0.0.1])
	by thor.piquan.org (8.12.10/8.12.10) with ESMTP id hBF5ktb0013354
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 14 Dec 2003 21:46:55 -0800 (PST)
	(envelope-from joelh@thor.piquan.org)
Received: (from joelh@localhost)
	by thor.piquan.org (8.12.10/8.12.10/Submit) id hBF5ktKI013353;
	Sun, 14 Dec 2003 21:46:55 -0800 (PST)
	(envelope-from joelh)
Message-Id: <200312150546.hBF5ktKI013353@thor.piquan.org>
Date: Sun, 14 Dec 2003 21:46:55 -0800 (PST)
From: Joel Ray Holveck <joelh@piquan.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] mergemaster does not warn for obsolete rc.d files
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         60246
>Category:       bin
>Synopsis:       [PATCH] mergemaster does not warn for obsolete rc.d files
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    dougb
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Dec 14 21:50:24 PST 2003
>Closed-Date:    Thu Jan 01 19:21:33 PST 2004
>Last-Modified:  Thu Jan 01 19:21:33 PST 2004
>Originator:     Joel Ray Holveck
>Release:        FreeBSD 5.2-RC i386
>Organization:
>Environment:
System: FreeBSD thor.piquan.org 5.2-RC FreeBSD 5.2-RC #21: Sun Dec 14 19:40:38 PST 2003 joelh@thor.piquan.org:/usr/local/src/freebsd/obj/usr/local/src/freebsd/src/sys/THOR i386
>Description:
From UPDATING:

20030829:
	The following rc.d scripts have been removed and should be
	deleted from your installation: atm2.sh atm3.sh devdb
	localdaemons network1 network2 network3. Depending on when
	you last updated world and used mergemaster(8) you may or
	may not have problems during the rc boot sequence. The simplest
	solution is an 'rm -rf /etc/rc.d/*' and then 'mergemaster -i'.
	The atm2.sh atm3.sh and devdb scripts were removed some time
	ago, so depending on when you installed -CURRENT these scripts
	may or may not exist on your system.

These scripts can certainly cause boot problems.  It would be nice if
mergemaster warned the user if these scripts existed, and offered to
move them.
>How-To-Repeat:
From a 5.1 system, upgrade to 5.2-RC, but don't delete anything from
rc.d.  On your next boot, look for failures.  If you have them
installed, error messages will get logged into /var/log/messages from
dhcpd, samba, postgres, and probably others.
>Fix:
Apply the following patch to src/usr.sbin/mergemaster/mergemaster.sh:

--- mergemaster.sh.~1~	Sun Dec 14 21:33:45 2003
+++ mergemaster.sh	Sun Dec 14 21:39:59 2003
@@ -650,6 +650,71 @@
   esac
 esac
 
+for file in atm2.sh atm3.sh devdb localdaemons network1 network2 network3; do
+  if [ -f "${DESTDIR}/etc/rc.d/${file}" ]; then
+    OLD_RC_D_PRESENT=1
+    break
+  fi
+done
+
+case "${OLD_RC_D_PRESENT}" in
+1)
+  echo ''
+  echo " *** There are old rc.d scripts in ${DESTDIR}/etc/rc.d."
+  echo ''
+  echo '     Depending on when you last updated world and used mergemaster'
+  echo '     they may or may not cause problems during the rc boot sequence.'
+  echo '     These files can and probably should be removed.'
+  echo ''
+
+  case "${AUTO_RUN}" in
+  '')
+    echo -n 'Move these files to /var/tmp/mergemaster/old_rc_d? [yes] '
+    read MOVE_OLD_RC_D
+
+    case "${MOVE_OLD_RC_D}" in
+    [nN]*) ;;
+    *)
+      mkdir -p /var/tmp/mergemaster/old_rc_d
+        for file in atm2.sh atm3.sh devdb localdaemons network1 network2 \
+	  network3; do
+          if [ -f "${DESTDIR}/etc/rc.d/${file}" ]; then
+            mv ${DESTDIR}/etc/rc.d/${file} /var/tmp/mergemaster/old_rc_d/
+          fi
+        done
+      echo '  The files have been moved to /var/tmp/mergemaster/old_rc_d/'
+      press_to_continue
+      ;;
+    esac
+    ;;
+  *)
+    # auto_run is a bit anomolous for this case.  We don't terribly
+    # want to risk the next boot being messed up, but we don't really
+    # want to modify /etc.  (The run may not even be for an immediate
+    # installation!)
+    #
+    # We create dummy files in our temp directory.  When the operator
+    # manually reviews the files, then this should clue him that
+    # attention is needed for these files.  If the files are copied
+    # into /etc later, bulk-style, then the files won't hurt the boot
+    # process.  (As a precaution, we don't make them executable, so
+    # they won't even be run.)  The content is to make them show up in
+    # the summary at the end, which doesn't list 0-length files.
+    for file in atm2.sh atm3.sh devdb localdaemons network1 network2 \
+      network3; do
+      if [ -f "${DESTDIR}/etc/rc.d/${file}" ]; then
+        echo "   *** /etc/rc.d/${file} will remain for your consideration"
+        cat > ${TEMPROOT}/etc/rc.d/${file} <<EOF
+#! /bin/sh
+# This file is obsolete and should be deleted.  See UPDATING for details.
+exit 0
+EOF
+      fi
+    done
+  ;;
+  esac
+esac
+
 # Use the umask/mode information to install the files
 # Create directories as needed
 #
>Release-Note:
>Audit-Trail:

From: Andy Farkas <andyf@speednet.com.au>
To: Joel Ray Holveck <joelh@piquan.org>
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: bin/60246: [PATCH] mergemaster does not warn for obsolete rc.d
 files
Date: Wed, 17 Dec 2003 07:03:56 +1000 (EST)

 Try reading the man page for mergemaster. Look for the -v option.
 
 Also, this isn't really a "serious" "medium" priority bug.
 
 This PR should be closed.
 
 --
 
  :{ andyf@speednet.com.au
 
         Andy Farkas
     System Administrator
    Speednet Communications
  http://www.speednet.com.au/
 
 
Responsible-Changed-From-To: freebsd-bugs->dougb 
Responsible-Changed-By: kris 
Responsible-Changed-When: Fri Dec 26 07:54:57 PST 2003 
Responsible-Changed-Why:  
Assign to mergemaster maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=60246 
State-Changed-From-To: open->closed 
State-Changed-By: dougb 
State-Changed-When: Thu Jan 1 19:20:26 PST 2004 
State-Changed-Why:  

I fixed the problem a significantly different way, but thanks 
for the problem report. I agree that this is an issue that 
needed to be addressed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=60246 
>Unformatted:
