#! /bin/sh # wrapper for flashdist.sh - write to a file instead of a device # for future DD'ing on another platform... # # originally hacked together by William Yang # You can reach me via webform: http://wdyllc.com/contact/ # # if products are derived from this code, please give me credit for # whatever contributions I generate. # # uses Flashdist. http://www.nmedia.net/~chris/soekris/ # that's where the real magic is.... # # warning: use of this program may do heinous things. Don't use it # unless you're willing to accept the associated risks. # # no waranties, express or implied. no support. no fitness for any # particular purpose. This program is for educational purposes only and # is a demonstration of a technique. it is not intended to be used # without fully understanding its functions and modifying its # instructions to fit your specific needs. # # I wasn't kidding. Don't use this without modifying it to fit your # specific needs. exit 0 syspath=/ tempfile=/tmp/building-flashdist.$$ device=svnd0 imagefile=$HOME/distrib-tools/MySystem/out/image.fs kernelfile=/bsd distfilelist=$HOME/distrib-tools/MySystem/files flashdistpath=$HOME/distrib-tools/reference/flashdist-20030520/flashdist.sh ## passed on to the flashdist script # drive geometry information -- get the right one for YOUR flash instead # of using mine! totalsize=125440 # "total sectors:" bytessec=512 # "bytes/sector:" sectorstrack=32 # "sectors/track:" sectorscylinder=256 # "sectors/cylinder:" trackscylinder=8 # "tracks/cylinder:" cylinders=490 # "cylinders:" # encrypted password encpass='[sorry, this information was supressed]' # syslog server syslogserver="[supressed]" ## end of flashdist customization export totalsize bytessec sectorstrack sectorscylinder trackscylinder cylinders export syslogserver encpass # create an image file, if one doesn't exist. if [ ! -f $imagefile ] ; then dd if=/dev/zero of=$imagefile bs=512 count=$totalsize fi # treat the image file as a device in OpenBSD vnconfig -c $device $imagefile # remove tempfile if it exists. [ -f $tempfile ] && /bin/rm -f $tempfile # # figure out if you're missing any libraries and add them magically # to the distribution, if necessary... # # this is the only remotely innovative thing I've done with this # script. # cp $distfilelist $tempfile ( cd / ; ldd `egrep -v /usr/lib $distfilelist` 2>/dev/null ) | \ grep /usr/lib | \ sed -e 's/^[^\-]*-/-/g' \ -e 's/^.*=> /\./g' \ -e 's/ .*$//g' | \ sort -u >> $tempfile # invoke flashdist $flashdistpath $device $tempfile $kernelfile $syspath # clean up [ -f $tempfile ] && /bin/rm -f $tempfile # no longer treat the image file as a device... vnconfig -u $device # done.