fcopy(8) fcopy(8) 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 tem- plate 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 (or their analog variables) and a SOURCE are required. -c class[,class] Define classes. Multiple classes must be comma sep- arated. 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. -l Do not copy if destination is a symbolic link -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-mode or data of source file. -r Copy recursively (traverse down the tree). Copy all Sep 12,2001 1 fcopy(8) fcopy(8) files below SOURCE. These are all subdirectories leaves in the SOURCE tree. -s source_dir Look for SOURCE files relative to source_dir. Use $FAI_FILES if not specified. -t target_dir Copy files relativ to target_dir. Use $FAI_ROOT if not specified. -v Create verbose output. EXAMPLES Suppose the source directory /files/etc/X11/XF86Config consists of following files: CAD DEFAULT LAB MACH64 server1 faifoo file-modes Each file is an instance of a XF86Config file for a dif- ferent xserver configuration except file-modes, which holds the file creation data. The command # fcopy -s /files -t /tmp/target /etc/X11/XF86Config copies one of these files from the directory /files/etc/X11/XF86Config to the file /tmp/tar- get/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- Sep 12,2001 2 fcopy(8) fcopy(8) modes in the source directory can contain one line for each class. The space separated parameter 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. 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 configura- tion files on a huge number of hosts. SEE ALSO The programs is part of FAI (fully automatic installa- tion). See the FAI manual for more information how to use fcopy. The FAI homepage is http://www.informatik.uni- koeln.de/fai. AUTHOR Thomas Lange Sep 12,2001 3