File:  [NetBSD Developer Wiki] / wikisrc / tutorials / how_to_update_a_netbsd_system_with_haze.mdwn
Revision 1.3: download - view: text, annotated - select for diffs
Mon Apr 8 22:01:50 2019 UTC (21 months, 2 weeks ago) by sevan
Branches: MAIN
CVS tags: HEAD
Link to tech-userlevel post with link to src.

##  What it does:

Offer a system to generate binary updates for NetBSD (NOT patches), install,
remove with full "rollback to previous state" support, and manage them. Simple
dependencies are allowed. It also allows auto-generating security advisories
from update data.

Without further ado, here's how to use it.

##  Update producer: (people who *create* updates)

    
      1. Write the .plist file to describe the update, and put it online.
         Update the index file to include the update id. (for example,
         NetBSD-UP2007-0001)
    
    
         Examples for updates are available:
    
    
         <http://www.NetBSD.org/~elad/haze/Updates/2006/NetBSD-UP2006-0001.plist>
         <http://www.NetBSD.org/~elad/haze/Updates/2006/NetBSD-UP2006-0002.plist>
    
    
         The index file looks like this:
    
    
         <http://www.NetBSD.org/~elad/haze/Updates/2006/INDEX>
    
    
         Note the directory hierarchy: the year is important; everything
         else can be tuned, but the structure. For now.
    
    
      2. Maintain a build directory for ports you want to generate updates
         for. This is "obj-dir" in the config file (/etc/haze/haze.conf):
    

<key>obj-dir</key> <string>/usr/netbsd/objdir/xphyre/destdir.%m</string>

    
         Haze knows to replace "%m" with the machine type. The default is
         "/usr/obj/%s-%r/destdir.%m", where "%s" will be replaced by the
         string "NetBSD", and "%r" will be replaced by the release, for
         example, "4.0".
    
    
         To keep this directory up-to-date, all the producer has to do is
         run the build after the source is updated with the fix.
    
    
      3. Maintain a list of "targets" you want to monitor. Haze calls a
         combination of OS-release-machine a "target". For example,
         "NetBSD-4.0-amd64" is a target. By default, Haze will only generate
         updates for the host it runs on. You can override that, though:
    

<key>generate-targets</key> <array> <string>NetBSD-4.0-amd64</string>
<string>NetBSD-4.0-i386</string> <string>NetBSD-3.0-amd64</string>
<string>NetBSD-3.0-i386</string> </array>

    
      4. After the new files are built, generate updates. This is done using
         the -G flag. For example, if you just rebuilt for
         NetBSD-UP2007-0001, and want to generate updates for it:
    

haze -G -U NetBSD-UP2007-0001

    
         The updates will show up in the output dir, /tmp by default, and
         will be in the form of NetBSD-UP2007-0001-4.0-amd64.tar.gz.
    
    
      5. Put the updates online, in the Updates/ directory. For example,
         this would be a valid URL to an update package:
    
    
          <http://www.NetBSD.org/~elad/haze/Updates/NetBSD-UP2006-0001-3.0-amd64.tgz>
    

##  Update consumer: (people who *apply* updates)

    
      1. Make sure there's a /etc/haze directory and that it's writable by
         the user Haze is running as. I would elaborate on this too much,
         but you *should* be able to tell Haze to perform updating on a
         specified root directory, and then do the sync yourself, if you
         don't trust running Haze as root. If you do:
    

# mkdir /etc/haze

    
         Everything else, including the configuration file and local
         database, will be created by Haze automagically. You can inspect
         the default values used in haze.h.
    
    
      2. By default, things should pretty much Just Work. Therefore, here
         are some usage examples:
    

Show the batch of updates waiting to be installed:

haze -B

Install all pending updates:

haze

Show locally known updates (including installed, ignored, and not applicable
updates):

haze -L

Install a specific update:

haze -U NetBSD-UP2006-0001

Rollback an update:

haze -R -U NetBSD-UP2006-0001

View details about an update:

haze -V -U NetBSD-UP2006-0001

Explicitly ignore an update:

haze -i -U NetBSD-UP2006-0001

Operate in dummy mode, and just print stuff you'd do:

haze -x ...

Generate a security advisory skeleton for an update:

haze -S -U NetBSD-UP2006-0001

List available command line options:

haze -h

#See also
[NetBSD updating system](https://mail-index.netbsd.org/tech-userlevel/2007/11/06/0001.html)

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb