=head1 NAME

B<imgexport> - Exports an xCAT image.

=head1 SYNOPSIS

B<imgexport [-h| --help]>

B<imgexport image_name [destination] [[-e|--extra file:dir] ... ] [-p|--postscripts node_name] [-v|--verbose]>


=head1 DESCRIPTION

The imgexport command will export an image that is being used by xCAT.  To export images, you must have the images defined in the I<osimage> table. All the columns in the I<osimage> and I<linuximage> tables will be exported. In addition, the following files will also be exported.

For statefull:
  x.pkglist
  x.otherpkgs.pkglist
  x.tmpl
  x.synclist

For stateless:
  kernel
  initrd.gz
  rootimg.gz
  x.pkglist
  x.otherpkgs.pkglist
  x.synclist
  x.postinstall
  x.exlist


For statelite:
  kernel
  initrd.gz
  root image tree
  x.pkglist
  x.synclist
  x.otherpkgs.pkglist
  x.postinstall
  x.exlist

where x is the name of the profile.


Any files specified by the -e flag will also be exported. If -p flag is specified, the names of the postscripts and the postbootscripts for the given node will be exported. The postscripts themsleves need to be manualy exported using -e flag. 

For statelite, the litefile table settings for the image will also be exported. The litetree and statelite tables are not exported.

=head1 OPTIONS


B<-e|--extra> I<srcfile:destdir>    Pack up extra files. If I<destdir> is omitted, the destination directory will be the same as the source directory. 

B<-h|--help>                         Display usage message.
  
B<-p|--postscripts> I<node_name>  Get the names of the postscripts and postbootscripts for the given node and pack them into the image. 

B<-v|--verbose>                      Verbose output.

I<image_name>                        The name of the image. Use I<lsdef -t> osimage to find out all the image names. 

I<destination>                       The output bundle file name. 


=head1 RETURN VALUE

0 The command completed successfully.

1 An error has occurred.

=head1 EXAMPLES

1. Simplest way to export an image.  If there is an image in the osimage table named 'foo', then run:

B<imgexport foo>

foo.tgz will be built in the current working directory.  Make sure that you have enough space in the directory that you are in to run imgexport if you have a big image to tar up.

2. To include extra files with your image:

B<imgexport Default_Stateless_1265981465 foo.tgz -e /install/postscripts/myscript1  -e /tmp/mydir:/usr/mydir>

In addition to all the default files, this will export I</install/postscripts/myscript1> and the whole directory I</tmp/dir> into the file called foo.tgz.  And when imgimport is called  I</install/postscripts/myscript1> will be copied into the same directory and I</tmp/mydir> will be copied to I</usr/mydir>. 

3. To include postscript with your image:

B<imgexport Default_Stateless_1265981465 foo.tgz -p node1 -e /install/postscripts/myscript1>

The I<postscripts> and the I<postbootscripts> names specified in the I<postscripts> table for node1 will be exported into the image. The postscript I<myscript1> will also be exported.

=head1 FILES

/opt/xcat/bin/imgexport


=head1 SEE ALSO

L<imgimport(1)|imgimport.1>