Provided by: fai-client_3.4.8ubuntu5_all bug

NAME

       fcopy - copy files using classes

SYNOPSIS

       fcopy [options] SOURCE...

DESCRIPTION

       Copy a file from SOURCE to its target using classes.  It also sets permission modes, owner
       and group.  Each SOURCE argument is a directory which contains one or more template  files
       for  the  source  file to copy.  Depending on the list of defined classes, one file of the
       source directory is selected and copied to the target.  The target filename is the name of
       the source directory.

       The  exit  code  returned  by fcopy is 0 if all files are copied successfully and >0 if an
       error occurs.  For every successfully copied file, a log message is  printed  to  standard
       output.

OPTIONS

       Options -c, -s, -t and a SOURCE are required. Usually -c, -s and -t
              are set via variables in FAI.

       -B     Remove  backup  files  with  suffix  .pre_fcopy.  You  can also set the environment
              variable FCOPY_NOBACKUP to 1.

       -b dir Don't copy files to file.pre_fcopy, but use hierarchy  under  "dir"  instead.   The
              same effect is achieved by setting environment variable FAI_BACKUPDIR.

       -c class[,class]
              Define  classes.   Multiple classes must be comma separated.  If not specified, use
              the shell environment variable $classes (space separated).   The  first  class  has
              lowest priority.

       -C file
              Read  classes  from  file.   Lines  can  contain  multiple  classes which are space
              separated.  Lines starting with # are comments.

       -d     Delete target file if no class applies.

       -D     Create debugging output.

       -F file
              Read list of sources from file.  One SOURCE per line.

       -h     Show help, version and summary of options.

       -i     Ignore warnings about no matching class and always exit with 0.

       -I dir[,dir]
              Override list of ignored directories when recursing. If not given, it is taken from
              $FCOPY_IGNOREDIRS  and  as a last chance an internal list of known revision control
              system's metadata is used (CVS, .cvs, {arch}, .arch-ids).

       -l     Do not copy if destination is a symbolic link

       -L file
              Log SOURCE and used class to file.  Output format is
              SOURCE CLASS COMMENT
              where COMMENT gives  some  information  about  why  the  file  has  been  preserved
              (especially  useful  in  combination with -P). If not specified and $LOGDIR is set,
              use $LOGDIR/fcopy.log.

       -m user,group,mode
              Set user, group and mode for all copied files (mode as octal number, user and group
              numeric id or name).  If not specified, use file file-modes or data of source file.

       -M     Use default values for user, group and mode.  This is equal to -m root,root,0644

       -n     Print  the  commands,  but  do  not  execute  them. This is like --dry-run in other
              programs. You can enable it for all calls  of  fcopy  by  setting  the  environment
              variable $FCOPY_DRYRUN.

       -P plog,changes
              Don't  compare  files literally, but use information from files plog and changes: A
              file is overwritten when either another class applies (plog is a log generated with
              -L  in  the  previous  run,  so  it  now contains the necessary information) or the
              version of SOURCE for the used class  has  changed  (changes  is  checked  for  the
              appearance of the version itself, the file-modes and the postinst of the particular
              SOURCE) changes is a file specifying line by line in the last  column  which  files
              have  been  changed,  path  has  to  be  relative  to  $FAI, i.e. should begin with
              'files/'. This way, the logfile from cvs checkout could be used directly.   If  not
              given, $FCOPY_LASTLOG and $FCOPY_UPDATELOG are used for plog and changes.

       -r     Copy recursively (traverse down the tree).  Copy all files below SOURCE.  These are
              all subdirectory leaves in the SOURCE tree.  Ignore "ignored" directories (see "-I"
              for details).

       -s source_dir
              Look for SOURCE files relative to source_dir.  Use $FAI/files if not specified.

       -t target_dir
              Copy files relative to target_dir.  Use $FAI_ROOT if not specified.

       -U     If in softupdate mode skip this entire fcopy command.

       -v     Create verbose output.

SCRIPTS

       preinst
              If a file 'preinst' exists and is executable, it is used in the following way:

              1. a temporary copy of the file for the used class is created

              2. preinst  is  called  with the used class and the full pathname to this temporary
                 copy (you can do in-place substitutions or other modifications on this copy)

              3. the copy is compared to the destination and replaces it only if  there  are  any
                 differences

       postinst
              If  a  file  'postinst'  exists  and is executable, it is called after successfully
              having copied the file. It is called with two parameters, the class being used  and
              the  full  pathname  to  the  target  file. The variable ROOTCMD is set, so you can
              prepend it to commands which should be executed in the newly installed system.

EXAMPLES

       Suppose the source directory /files/etc/X11/XF86Config consists of the following files:

       CAD DEFAULT LAB MACH64 server1 faifoo file-modes postinst

       Each file is an instance of a XF86Config file for a different xserver configuration except
       file-modes, which holds the file creation data.  The command

           # fcopy -s /files -t /target /etc/X11/XF86Config

       copies  one  of  these  files  from  the  directory  /files/etc/X11/XF86Config to the file
       /target/etc/XF86Config.  For all defined classes, fcopy  looks  if  a  corresponding  file
       exists.   The class with the highest priority will be used for copying.  Here are examples
       of defined classes and the file which will be copied by fcopy.

             Defined classes                   File used for copy

             DEFAULT,LAB,server3               LAB
             DEFAULT,CAD,server1               server1
             DEFAULT,MACH64,ant01              MACH64
             DEFAULT,TFT,ant13                 DEFAULT

       In FAI (look at SEE ALSO) the list of defined classes starts with  DEFAULT  and  the  last
       class is the hostname.  So DEFAULT is only used when no file for another class exists.  If
       a file is equal to the hostname, this will be used, since hostname should  always  be  the
       last class.

       User,  group  and permissions for the files can be defined in several ways.  Option -m has
       the highest priority and will be used for all files, if specified.  The file file-modes in
       the  source directory can contain one line for each class.  The space separated parameters
       are:

       owner group mode class

       where owner and group can be specified by numeric id or by name.  The file permissions are
       defined by mode, which must be octal.  If class is missing, the data is used for all other
       classes, for which no data is defined.  If neither -m or file-modes data is available, the
       user, group and mode of the source file will be used for the target file.

       Missing subdirectories for the target file are created with mode 0755.  If the destination
       file already exists and is different from  the  source  file,  the  suffix  .pre_fcopy  is
       appended  to the old version of the target file.  If source and target files are equal, no
       copy is performed.  A copied file gets the same access and modification time as the source
       file,  not  the  time  of the copy.  If also the file postinst exists, it will be executed
       after the file was copied.

NOTES

       Do not create a file DEFAULT if no reasonable default  configuration  file  can  be  used.
       It's better to exit with an error than to copy a wrong configuration file.

       This  command  can  also  be used to maintain your configuration files on a huge number of
       hosts.

SEE ALSO

       ftar(8)

       This program is part of FAI (Fully Automatic Installation).  See the FAI manual  for  more
       information on how to use fcopy.  The FAI homepage is http://fai-project.org.

AUTHOR

       Thomas Lange <lange@informatik.uni-koeln.de>
       Henning Glawe <glaweh@physik.fu-berlin.de>