On Thu, Mar 21, 2013 at 08:45:20PM -0400, Michael K. Johnson wrote:
> Since you and Dick Marinus said on IRC that you would be willing to
> help users with it and contribute fixes to it, I'm willing to put it
> up publicly with all these caveats attached somehow.  I think I'll
> put it on github and use the associated issue tracker to note the
> bugs and limitations that I've listed in this email, and then I'll
> follow up with a pointer to the repository on github and expect some
> help fixing up those issues.

https://github.com/johnsonm/flimage

I'm counting on your help to fix this up a bit!  Note the DCO process
for contributions as documented in README.md.

Note also the issues at: https://github.com/johnsonm/flimage/issues

It comes with at least a tiny bit of help...

$ flimage --help
usage: flimage [-h] -b BASENAME [-s SIZE] [--sparse] -d DIR [-m MODEL]
               [-M MODELCACHE_CACHE] [-D ROOT_DEVICE] [--pre-image PRE_IMAGE]
               [--post-image POST_IMAGE] [--post-script POST_SCRIPT]
               [--preserve-root] [-i INITLEVEL] -t {rawHd,rawFs,ami}
               [--tarball]

Build images locally

optional arguments:
  -h, --help            show this help message and exit
  -b BASENAME, --basename BASENAME
                        basename for produced files
  -s SIZE, --size SIZE  size of image file to create in MiB
  --sparse              create sparse image file
  -d DIR, --dir DIR     work directory
  -m MODEL, --model MODEL
                        file containing system model
  -M MODELCACHE_CACHE, --modelcache-cache MODELCACHE_CACHE
                        directory for cache of modelcache files
  -D ROOT_DEVICE, --root-device ROOT_DEVICE
                        name of root device (e.g. /dev/xvda1)
  --pre-image PRE_IMAGE
                        [prefix:]archive to unpack before any system model
  --post-image POST_IMAGE
                        [prefix:]archive to unpack after any system model
  --post-script POST_SCRIPT
                        shell (-c) to run in chroot after post images unpacked
  --preserve-root       do not unset the root password
  -i INITLEVEL, --initlevel INITLEVEL
                        default initlevel for the image
  -t {rawHd,rawFs,ami}, --type {rawHd,rawFs,ami}
                        type of image to build
  --tarball             create tarball from image file


A typical invocation might be something like:

$ sudo flimage --basename server \
  --type rawHd \
  --initlevel 3 \
  --size 5000 \
  --sparse \
  --dir . \
  -M ./mcc \ 
  --pre-image mypasswdandgroup.tar.gz \
  --post-image /home:myhomedir.tar.gz \
  --post-script --post-script "sed -i 's/^PasswordAuthentication 
yes/PasswordAuthentication no/' /etc/ssh/sshd_config" \
  --preserve-root

This will send lots of output to the screen, and will also log the
output to a file in the same directory.  It will end up creating a
raw hard drive (partitioned) image in the file ./server.img.  That
will be 5000MiB in size (with 2048 sectors reserved).  It will use
the ext4 filesystem.  The image file will be sparse.  The model cache
file will be saved in the ./mcc directory by the checksum of the model
text, and if this same model is built again, regardless of the type
of image being built, the model cache will be used to speed up the
next build.  Before running the "conary sync" that installs the
system contents, the file "mypasswdandgroup.tar.gz" will be unpacked
into the image.  After the sync completes, the file "myhomedir.tar.gz"
will be unpacked relative to the /home directory in the image, and
password authentication will be disabled for sshd.

Note that --pre-image, --post-image, and --post-script are multi-valued;
you can provide them several times to unpack several images and/or
run several scripts.  Currently, the --pre-image and --post-image take
only tar.gz files, no other compression or archive format.

_______________________________________________
Foresight-devel mailing list
[email protected]
https://lists.foresightlinux.org/mailman/listinfo/foresight-devel

Reply via email to