freebsd-update presents me with dozens of diffs, what is an easy way to process these

I am upgrading a FreeBSD 8.3-RELEASE system to FreeBSD 9.0-RELEASE using freebsd-update.

I start off with some simple commands:

Code:
# freebsd-update -r 9.0-RELEASE upgrade

At one point in the process, freebsd-update performs a diff on files which are different then what is expected for the 9.0-RELEASE. It compares the current version on the system with the new changes added from 9.0-RELEASE. I have a modified a couple dozen files under /etc like /etc/passwd /etc/group, /etc/ttys, /etc/ntp. freebsd-update presents me a diff once per file.

Thus, I am presented with dozens and dozens of diffs which open in a vi window and look like this:

Code:
    The following file could not be merged automatically: /etc/ntp.conf
    Press Enter to edit this file in vi and resolve the conflicts
    manually...

    ### vi window opens

    <<<<<<< current version
    driftfile /etc/ntp/drift
    =======
    #
    # $FreeBSD: release/9.0.0/etc/ntp.conf 195652 2009-07-13 05:51:33Z dwmalone $
    #
    # Default NTP servers for the FreeBSD operating system.
    #
    # Don't forget to enable ntpd in /etc/rc.conf with:
    # ntpd_enable="YES"
    #
    # The driftfile is by default /var/db/ntpd.drift, check
    # /etc/defaults/rc.conf on how to change the location.
    #
    >>>>>>> 9.0-RELEASE
    
    restrict default notrust nomodify ignore

And so on.

This requires that I manually edit each file and remove the strings like `<<<<<<< current version` `>>>>>>> 9.0-RELEASE` and `=======`, and manually merge these files. As I discovered afterwards, if I don't remove these strings, they end up in the file afterwards. There are 10-20 files which differ between 8.3 and 9.0, and I have a dozen local modifications myself.

It appears that `freebsd-update` is using a diff, sdiff or a mergemaster function of some sort, but I can't tell what it is doing exactly. This screen doesn't look like sdiff or diff.

Processing these files is tedious and error prone. Is there a way that I can just say "Accept new version" or "keep old version" or "Your merge is correct"? Or 'use sdiff'

There has got to be an easier way to deal with these files. I must be missing something. This isn't a huge problem for one machine, but eventually I'll be doing this dozens of times and I want to find an easier way.
 
freebsd-update uses merge, which is not very convenient. To upgrade from 8.3 to 9.0, it would be better to compile from source and use mergemaster which is very well designed.
 
Thanks jdn06 .

It certainly looks like freebsd-update uses merge(1). The example from the manpage looks like the diff that I am seeing:

Code:
       A typical conflict will look like this:

	      <<<<<<< file A
	      lines in file A
	      =======
	      lines in file B
	      >>>>>>> file B
 
Seems it would be nice to do a rudimentary check for different version names, for example -
Code:
# $FreeBSD$

to the newer

Code:
# $FreeBSD: release/9.0.0/etc/mac.conf 122726 2003-11-15 02:08:01Z rwatson $

or similar - you know, basically an enhanced sed substitution of the old
Code:
'# $FreeBSD'*'$'
to the updated. Would eliminate 90% of the editing of files - but then again, I get the impression that I'd have to learn C to make that change a priority, or maybe a premerge clause in freebsd-update.. Will look at the code and see - I like to think of FreeBSD as being simpler to administer in terms of number of commands, and figure there's no reason not to make it take less time to do a binary update. If I am wrong, feel free to correct/update me as I was just going through the same ordeal for the past few hours before deciding that there had to be a better way and now I am building source.
 
Back
Top