recursive fcopy for the complete files directory?

Michael Tautschnig michael.tautschnig at
Thu Jun 2 16:04:23 CEST 2005

> Which is somehow ugly (I often don't like the idea anyway of having
> these files named as classes, but when i thought about having another
> intermediate directory with the class name and put the file in it, I
> didn't like that also, so it seems the way it is is the one that sucks
> less). 
> I'd like to able to just manage a whole
> directory of files belonging together to one useful configuration
> in a single directory like:
> /files/etc/fai/UBUNTU-FAI-SERVER/
> 				fai.conf
> 				make-fai-nfsroot.conf
> 				menu-lst
> 				sources.list
> /files/etc/fai/FAI-SERVER/	
> 			fai.conf
> 			make-fai-nfsroot.conf
> 			menu-lst
> 			sources.list
> Would it be a bad idea if I'd add an option to fcopy that could handle
> this? Hmm, I guess it could work and be nice, but it might interfere
> with the "-r" when I use it as Henning does...

As far as I can see, at least keeping such a structure within the
"/files"-subtree wouldn't break "fcopy -r" -- it simply wouldn't do anything
with those files, as long as they aren't named like any of your classes.

Thus, you could probably do it with a quite simple bash-function for each of
your directories that demand special treatment:

copy_dir() {
  #params: directory
  local dir=$1
  local class_dir
  if [ ! -d "$FAI/files/$dir" ] ; then
    echo "Source directory not found!"
    return 1

  for c in $classes ; do
    [ -d "$FAI/files/$dir/$c" ] && class_dir="$FAI/files/$dir/$c"

  if [ -z $class_dir ] ; then
    echo "No usable directory found!"
    return 2

  local current=`pwd`
  local pattern
  cd $class_dir
  if [ `ls -d .* | wc -l` -gt 2 ] ; then
    tar cfp - --exclude="CVS" --exclude=".svn" --exclude="postinst" {.[^.]*,*} | tar xf - -C ${target}/$dir
    tar cfp - --exclude="CVS" --exclude=".svn" --exclude="postinst" * | tar xf - -C ${target}/$dir

  cd $current
  if [ -x $class_dir/postinst ] ; then
    return $?
    return 0

Well, there is no way to support "file-modes", at least no using the current
format of file-modes.


More information about the linux-fai mailing list