[Soekris] flashdist.sh-derived script (OpenBSD users)

Jeff Quast af.dingo at gmail.com
Fri Sep 15 01:32:18 UTC 2006


flashdist.sh is a script by Chris Cappuccio, it can be found at
http://www.nmedia.net/~chris/soekris/

In short, it does an OpenBSD install onto a CF card, using an existing
OpenBSD system. This allows you to prepare a CF card without using an
embedded device to netboot an install, alternatively using a cheap CF
card reader to prepare a CF card (or multiples of them).

I've modified flashdist.sh a bit. I've emailed the changes to Chris.
Since then it appears he's had a release with features I have failed
to add. Regardless, I believe the overlay feature I have implemented
is a pleasant one to work with, so I thought I would share it with
soekris-tech at .

I would appreciate any feedback or bug fixes. And of course it is BSD
licensed. If you would like to take it and run, feel free. You must
maintain Chris's copyright header.

The major differences between my version and the one available on
Chris's website are:
- extract the original openbsd base sets (or your own,
  doesn't matter)
- optionally overlay a directory on top of the root directory of
  target media. This is a custom / of files that require to be altered
  from the default base sets. If you make your own base set, this
  isn't needed. a find of one of my overlays is included.
  permissions are copied! Be sensible!
- vnconfig (svnd) support.
- settings.rc greatly reduces excessive command arguments
  and script length
- This script does not cater to tight disk space, such as set up
  mfs for you, custom rc scripts, kernel config files, etc. Though
  the functionality is there to do yourself using $exclude and
  $overlay.

I did the best I could to minimize the features and length of the
script for easier maintenance. This is actually all just a result of
modifying flashdist-20060116 for the past 9 months. My intention is
that the next person who begins doing this may find it easier using
the attached code as a base.

I've also tried to make it safe to use, such as checking for a disks
already being mounted and lots of tests before operations are
performed. I once used sd0 instead of sd6, blindly copying the example
usage, and teared my root disk apart. Thank god for ROOTBACKUP=1 :)

So here's how it looks,

dingo:23851$ ./flashdist.sh
Usage: ./flashdist.sh disk [./settings.rc]

dingo:23852$ egrep ^[^#] settings.rc
cylinders=992
trackscylinder=128
sectorstrack=63
image=./fdist.out
tmp=/storage/tmp
srcdir="/home/ftp/pub/OpenBSD/snapshots/i386"
sets="base40 etc40 man40"
overlay="./overlay"
exclude=""
timezone=EST5EDT
genkeys=YES

dingo:23853$ sudo ./flashdist.sh svnd0

        Total Size: 7999488 (3999744M)
         Cylinders: 992     [C]
   Tracks/Cylinder: 128     [H]
  Sectors/Cylinder: 8064
     Sectors/Track: 63      [S]
      Bytes/Sector: 512

          Timezone: EST5EDT
        Input sets: base40 etc40 man40
       Output Disk: svnd0
      Output image: ./fdist.out

press return

preparing disk: dd vconfig fdisk disklabel newfs mount
extracting sets: base40 etc40 man40 copying... {overlay}.
setting up partitions: boot blocks MAKEDEV
Generating keys: ssh ipsec
Root Password:
        again:
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/svnd0a    3.7G    379M    3.1G    11%    /storage/tmp/_fd73
cleaning up: umount vnconfig
done!

dingo:23854$

attached is program source and related stuff.

Thanks,

jdq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: flashdist.jquast.tar
Type: application/x-tar
Size: 20480 bytes
Desc: not available
Url : http://lists.soekris.com/pipermail/soekris-tech/attachments/20060915/7f1c0347/flashdist.jquast-0001.tar


More information about the Soekris-tech mailing list