bin/96528: Fix mergemaster(8) to be upgrade-friendly

Ruslan Ermilov ru at FreeBSD.org
Sat Apr 29 19:00:27 UTC 2006


>Number:         96528
>Category:       bin
>Synopsis:       Fix mergemaster(8) to be upgrade-friendly
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Apr 29 19:00:20 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Ruslan Ermilov
>Release:        FreeBSD 6.1-PRERELEASE i386
>Organization:
>Environment:
>Description:
mergemaster(8) should use targets from the top-level makefile to do
its job.
>How-To-Repeat:
>Fix:
Index: mergemaster.8
===================================================================
RCS file: /home/ncvs/src/usr.sbin/mergemaster/mergemaster.8,v
retrieving revision 1.35
diff -u -r1.35 mergemaster.8
--- mergemaster.8	29 Apr 2006 18:21:43 -0000	1.35
+++ mergemaster.8	29 Apr 2006 18:47:27 -0000
@@ -54,7 +54,7 @@
 directory before beginning this process.
 .Pp
 The script uses
-.Pa /usr/src/etc/Makefile
+.Pa /usr/src/Makefile
 to build a temporary root environment from
 .Pa /
 down, populating that environment with the various
@@ -320,7 +320,7 @@
 #PRESERVE_FILES_DIR=/var/tmp/mergemaster/preserved-files-`date +%y%m%d-%H%M%S`
 #
 # Sourcedir is the directory to do the 'make' in (where the new files are)
-#SOURCEDIR='/usr/src/etc'
+#SOURCEDIR='/usr/src'
 #
 # The umask for mergemaster to compare the default file's modes to
 #NEW_UMASK=022
Index: mergemaster.sh
===================================================================
RCS file: /home/ncvs/src/usr.sbin/mergemaster/mergemaster.sh,v
retrieving revision 1.54
diff -u -r1.54 mergemaster.sh
--- mergemaster.sh	29 Apr 2006 18:21:43 -0000	1.54
+++ mergemaster.sh	29 Apr 2006 18:47:28 -0000
@@ -265,7 +265,7 @@
 while getopts ":ascrvhipCPm:t:du:w:D:A:U" COMMAND_LINE_ARGUMENT ; do
   case "${COMMAND_LINE_ARGUMENT}" in
   A)
-    ARCHSTRING='MACHINE_ARCH='${OPTARG}
+    ARCHSTRING='TARGET_ARCH='${OPTARG}
     ;;
   U)
     AUTO_UPGRADE=yes
@@ -412,7 +412,15 @@
 
 # Assign the source directory
 #
-SOURCEDIR=${SOURCEDIR:-/usr/src/etc}
+SOURCEDIR=${SOURCEDIR:-/usr/src}
+if [ ! -f ${SOURCEDIR}/Makefile.inc1 -a \
+   -f ${SOURCEDIR}/../Makefile.inc1 ]; then
+  echo " *** The source directory you specified (${SOURCEDIR})"
+  echo "     will be reset to ${SOURCEDIR}/.."
+  echo ''
+  sleep 3
+  SOURCEDIR=${SOURCEDIR}/..
+fi
 
 # Check DESTDIR against the mergemaster mtree database to see what
 # files the user changed from the reference files.
@@ -556,8 +564,8 @@
         ;;
       esac
       make DESTDIR=${TEMPROOT} ${ARCHSTRING} distrib-dirs &&
-      MAKEOBJDIRPREFIX=${TEMPROOT}/usr/obj make ${ARCHSTRING} obj &&
-      MAKEOBJDIRPREFIX=${TEMPROOT}/usr/obj make ${ARCHSTRING} all &&
+      MAKEOBJDIRPREFIX=${TEMPROOT}/usr/obj make ${ARCHSTRING} obj SUBDIR_OVERRIDE=etc &&
+      MAKEOBJDIRPREFIX=${TEMPROOT}/usr/obj make ${ARCHSTRING} all SUBDIR_OVERRIDE=etc &&
       MAKEOBJDIRPREFIX=${TEMPROOT}/usr/obj make ${ARCHSTRING} \
 	  DESTDIR=${TEMPROOT} distribution;} ||
     { echo '';
@@ -569,8 +577,8 @@
   *)
     # Only set up files that are crucial to {build|install}world
     { mkdir -p ${TEMPROOT}/etc &&
-      cp -p ${SOURCEDIR}/master.passwd ${TEMPROOT}/etc &&
-      cp -p ${SOURCEDIR}/group ${TEMPROOT}/etc;} ||
+      cp -p ${SOURCEDIR}/etc/master.passwd ${TEMPROOT}/etc &&
+      cp -p ${SOURCEDIR}/etc/group ${TEMPROOT}/etc;} ||
     { echo '';
       echo '  *** FATAL ERROR: Cannot copy files to the temproot environment';
       echo '';
@@ -647,7 +655,7 @@
     echo ''
     echo " *** Your umask is currently set to ${USER_UMASK}.  By default, this script"
     echo "     installs all files with the same user, group and modes that"
-    echo "     they are created with by ${SOURCEDIR}/Makefile, compared to"
+    echo "     they are created with by ${SOURCEDIR}/etc/Makefile, compared to"
     echo "     a umask of 022.  This umask allows world read permission when"
     echo "     the file's default permissions have it."
     echo ''
@@ -897,7 +905,7 @@
 fi
 
 # Using -size +0 avoids uselessly checking the empty log files created
-# by ${SOURCEDIR}/Makefile and the device entries in ./dev, but does
+# by ${SOURCEDIR}/etc/Makefile and the device entries in ./dev, but does
 # check the scripts in ./dev, as we'd like (assuming no devfs of course).
 #
 for COMPFILE in `find . -type f -size +0`; do
@@ -1180,7 +1188,7 @@
 case "${PRE_WORLD}" in
 '') ;;
 *)
-  MAKE_CONF="${SOURCEDIR%etc}share/examples/etc/make.conf"
+  MAKE_CONF="${SOURCEDIR}/share/examples/etc/make.conf"
 
   (echo ''
   echo '*** Comparing make variables'
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list