OpenBSD Journal

Introducing sysmerge(8)

Contributed by merdely on from the one-less-package-to-install dept.

Back in the OpenBSD 3.0 days, Christian Weisgerber (naddy@) imported sysutils/mergemaster into the ports tree. This tool is very useful for updating /etc after upgrading OpenBSD (see previous story). Bringing mergemaster, or something like it, into the base system had been up for discussion for a while. Recently, Antoine Jacoutot (ajacoutot@) took the initiative to create a new script, sysmerge(8), starting from mergemaster and ending up with something specific to OpenBSD.

Like mergemaster, sysmerge will build the new /etc (and /var & /root) files for comparison from an OpenBSD source tree. A new feature in sysmerge, though, is the ability to use an etcXY.tgz tarball directly. Using the command:

sysmerge -a -s /path/to/`arch -ks`/etc43.tgz
sysmerge will silently compare your /etc to what is in etc43.tgz until it reaches differences. Then, like mergemaster, sysmerge will prompt you to (d)elete the new file (keeping the old one), (i)nstall the new file or (m)erge the files using sdiff(1). The -a switch tells sysmerge to run in "automatic mode", automatically installing missing files, creating databases and devices and disabling strict file comparison using CVS Ids when possible. The -s ... switch tells sysmerge where to find the etc files for the update. Either a top-level source directory or an etcXY.tgz tarball file can be specified. /usr/src is used by default.

In automatic mode, once sysmerge is done comparing files, databases are rebuilt if their files have changed (like pwd.db, spwd.db, aliases.db, ...), new devices are created if a new MAKEDEV script is installed and directory permissions are verified. If -a was not specified, you are prompted to do these things.

This is a work in progress. Please test it out and provide feedback. Planned features include xetcXY.tgz support, possibly a non-interactive mode and a way to add files and directories to ignore during the comparison.

Thank you, Antoine, for working on sysmerge.

(Comments are closed)


  1. By Mike Erdely (merdely) mike@erdelynet.com on http://erdelynet.com/

    And, I just noticed that the sysmerge(8) man page hasn't hit the man.cgi yet.

    Until then, you can look at the man page's source.

  2. By Anonymous Coward (24.37.242.64) on

    sysmerge compares /etc to etc43.tgz from release(8) or snapshots or even from doing just a make build somehow? The etcXX.tgz is throwing me off here.

    Aside from this, this is great news to see something new like this!

    1. By phessler (phessler) on first undead, then not, then undead again.

      > sysmerge compares /etc to etc43.tgz from release(8) or snapshots or even from doing just a make build somehow? The etcXX.tgz is throwing me off here.
      >
      > Aside from this, this is great news to see something new like this!

      yes, you can give it etc43.tgz from release(8). Or any version that release(8) packed.

  3. By Anonymous Coward (2a01:348:159:2:21d:e0ff:fe3a:50cf) on

    Fantastic. My pkg_info | wc -l keeps getting smaller and smaller

  4. By Martin Schröder (84.137.109.226) martin@oneiros.de on http://www.oneiros.de

    Does it automatically ignore the sendmail docs which are IIRC installed in /etc?

    1. By sthen (2a01:348:108:155:20a:e4ff:fe2d:99ee) on

      > Does it automatically ignore the sendmail docs which are IIRC installed in /etc?

      I don't know exactly what you're referring to, but it does handle sendmail cf files specially. See for yourself...

      http://www.openbsd.org/cgi-bin/cvsweb/~checkout~/src/usr.sbin/sysmerge/sysmerge.sh?content-type=text/plain

      1. By Martin Schröder (84.137.111.3) martin@oneiros.de on http://www.oneiros.de

        > > Does it automatically ignore the sendmail docs which are IIRC installed in /etc?
        >
        > I don't know exactly what you're referring to, but it does handle

        The sendmail docs are installed under /etc. So before using mergemaster, you have to do
        cd /usr/src/usr.sbin/httpd
        make -f Makefile.bsd-wrapper distribution

        See Absolute OpenBSD, p. 333

        1. By Anonymous Coward (2a01:348:108:155:20a:e4ff:fe2d:99ee) on

          > > > Does it automatically ignore the sendmail docs which are IIRC installed in /etc?
          > >
          > > I don't know exactly what you're referring to, but it does handle
          >
          > The sendmail docs are installed under /etc.

          You've lost me there, surely they're in /usr/share/doc/smm/08.sendmailop and 09.sendmail, with a README in /usr/share/sendmail?

          > So before using mergemaster, you have to do
          > cd /usr/src/usr.sbin/httpd
          > make -f Makefile.bsd-wrapper distribution

          Oh, you mean httpd? They're not under /etc but they are in etcXX.tgz; so taking a quick glance at the code I linked to (which should also work on earlier OS releases if you want to try it), that would depend on whether you ask sysmerge to update using etcXX.tgz or from source.

          > See Absolute OpenBSD, p. 333

          "page 333 is not part of this book preview", says Google.

  5. By Mark Peloquin (incripshin) markpeloquin@gmail.com on

    Well I just tried it out, but I've kept my files up to date so it had nothing to do. I'll definitely use it in the future, though.

  6. By Jim Razmus II (jim) jtr2-undeadly@bonetruck.org on http://www.bonetruck.org/

    Now the challenge will be to NOT pkg_add mergemaster every time I build a machine. After years of snapshots, it has become ingrained in my keyboard.

    1. By sthen (2a01:348:108:155:20a:e4ff:fe2d:99ee) on

      > Now the challenge will be to NOT pkg_add mergemaster every time I build a machine. After years of snapshots, it has become ingrained in my keyboard.

      There's an easy way around that, involving cvs rm ;-)

  7. By Didier wiroth (158.64.58.6) http://www.wiroth.net on http://www.wiroth.net

    Nice tool!!!
    THANKS a lot!

    1. By Anonymous Coward (82.114.74.98) on

      There is sysmerge(8) man page in CURRENT (above link works now):

      http://www.openbsd.org/cgi-bin/man.cgi?query=sysmerge&sektion=8&apropos=0&manpath=OpenBSD+Current&arch=i386

      It first appeared in OpenBSD 4.4 tho :D :

      >HISTORY
      > The sysmerge script first appeared in OpenBSD 4.4.
      >
      >AUTHORS
      > The sysmerge shell script was written by Antoine Jacoutot
      > <ajacoutot@openbsd.org> using FreeBSD mergemaster written by Douglas
      > Barton <DougB@FreeBSD.org> as a base.
      >
      >OpenBSD 4.3 April 22, 2008

      Nice tool indeed, been using mergemaster, looking forward to try this one out.

  8. By Han (84.41.179.194) han@mijncomputer.nl on

    I still prefer the method which I use in mergeslave. I keep the etcXX.tgz tarball of the current release. When I install the new release I extract it in $PWD/old/ and the new etcXX.tgz tarball in $PWD/new/, then create a diff between those two directories and then I apply that diff to my system.

    Basically that's the idea which I use in OpenBSD-binary-upgrade.

Credits

Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]