Re: fcopy exits with an error if file is not updated because its up2date

2007-04-13 Thread Michael Tautschnig
> Hi,
> 
> fcopy exits with an error if a file is not updated because its up2date, I 
> believe that is a bug. Because everything _is_ ok.
> 
> So I used to always do "fcopy -i foo", which today I have changed to "fcopy 
> foo || true" - which at least will tell me in the logs that something is 
> wrong. But I would prefer not to get an exitcode!=0 from fcopy in the first 
> place. 
> 
> Opinions?
>

At least I'd also consider it a somewhat strange behaviour; but I can't say for
sure whether this is a bug or a feature; Henning or Thomas definitively had a
reason for implementing it that way.

However, I'd argue for some further command line parameter (I know, fcopy
already has quite a lot...) or some environment variable to make fcopy not exit
with an error in that special case.

Best,
Michael



pgpfpPI1XdzV4.pgp
Description: PGP signature


fcopy exits with an error if file is not updated because its up2date

2007-04-13 Thread Holger Levsen
Hi,

fcopy exits with an error if a file is not updated because its up2date, I 
believe that is a bug. Because everything _is_ ok.

So I used to always do "fcopy -i foo", which today I have changed to "fcopy 
foo || true" - which at least will tell me in the logs that something is 
wrong. But I would prefer not to get an exitcode!=0 from fcopy in the first 
place. 

Opinions?

BTW: the fcopy manpage says "OPTIONS  Options -c, -s, -t  (or  their  
analog  variables)  and  a  SOURCE  are required."
 This is not true anymore.


regards,
Holger

P.S.: resent because I have not received it on the list. 


pgp6oR0yM4X4D.pgp
Description: PGP signature


Re: fcopy exits with an error if file is not updated because its up2date

2007-04-11 Thread Oliver Osburg
* Holger Levsen <[EMAIL PROTECTED]> [070411 17:07]:
> Hi,
> 
> fcopy exits with an error if a file is not updated because its up2date, I 
> believe that is a bug. Because everything _is_ ok.
> 
> So I used to always do "fcopy -i foo", which today I have changed to "fcopy 
> foo || true" - which at least will tell me in the logs that something is 
> wrong. But I would prefer not to get an exitcode!=0 from fcopy in the first 
> place. 
> 
> Opinions?
> 
Hi,

yes, I agree! I'd prefer that behaviour, too. I also think that the
present behaviour is a bug...

regards, Oliver

--
 *  Oliver Osburg- Software and System Architect  *
 *  email: [EMAIL PROTECTED] phone: +49 179 50 76 784 *
 *  note: All above is my opinion unless said otherwise   *
 * One Unix to rule them all, One Resolver to find them,  *
 * One IP to bring them all and in the zone bind them.*


fcopy exits with an error if file is not updated because its up2date

2007-04-11 Thread Holger Levsen
Hi,

fcopy exits with an error if a file is not updated because its up2date, I 
believe that is a bug. Because everything _is_ ok.

So I used to always do "fcopy -i foo", which today I have changed to "fcopy 
foo || true" - which at least will tell me in the logs that something is 
wrong. But I would prefer not to get an exitcode!=0 from fcopy in the first 
place. 

Opinions?

BTW: the fcopy manpage says "OPTIONS  Options -c, -s, -t  (or  their  
analog  variables)  and  a  SOURCE  are required."
 This is not true anymore.


regards,
Holger


pgpzVocnYjqeo.pgp
Description: PGP signature


Extending fcopy

2006-12-07 Thread Michael Tautschnig
Hi all,

Janning has proposed quite a few enhancements to fcopy lately. I think the
resulting discussion should be bundled in a single thread and it should actually
move to linux-fai-devel (@Janning: don't know, whether you are subscribed to
this one already).

Just to summarize, the suggestions were:

- some -k/--keep option (which I'd rather call --keep-permissions :-) ) to
  retain the permissions of the file which should be overwritten (BTW: what
  should happen if there is no such file?)

- some way to return the number of files that were actually copied.


My objections were
- Adding code to a mission-critical tool like fcopy is dangerous.
- More options may confuse users.
- The intended behaviour may be simulated using pre-/postinst scripts.


In my opinion the first and the second are still valid, however, the third has
been proven to be _really_ clumsy. So I guess these options should be added, if
a proper patch can be provided.

Hoping for further discussion,
Michael




pgpldixqDwsaE.pgp
Description: PGP signature


Re: fcopy feature request: report if a file was copied

2006-12-07 Thread Michael Tautschnig
[...]
> 
> yes but imagine 
> fcopy -ir /etc/postfix/
> and i need a postinst script with 
>/etc/init.d/postfix reload
> 
> i have to place postinst inside
>   /etc/postfix/main.cf/BASE/postinst
>   /etc/postfix/master.cf/BASE/postinst
> right?
> 
Nearly correct - there is no such directory as BASE, but rather you'll have the
files
/etc/postfix/main.cf/BASE and /etc/postfix/main.cf/postinst


> and if i did change master.conf and main.conf postinst would be called two 
> times. and what if i have 30 files or more in /etc/postfix like virtual 
> tables ...
> 
Would you really change all of them at once? And furthermore, in case of postfix
there is usually no need for reloading it, it will at most be a call to postmap
(which should definitely go into the postinst script).

[...]

Even though I do see (very few) applications for such a code, the same
objections as for your -k,--keep-permissions apply here: It might add quit a bit
of code, which may cause quite a lot of trouble.

Don't get me wrong, I'd hope for a lot more of such ideas, but they must be
discussed thoroughly, even more so when touching mission-critical tools such as
fcopy.

Best,
Michael




pgphlfbnvz0lR.pgp
Description: PGP signature


Re: another fcopy feature request -k --keep-modes

2006-12-07 Thread Michael Tautschnig
> 
> sometimes i don't care about the owner:group:modes:timestamp
> example /etc/ssh/sshd_config. I just want to copy my content 
> to /etc/ssh/sshd_config, but owner, group and modes should be kept.
> 
> Of course i can add -m but then i need to know the correct permissions and 
> ownership of each file i want to change.
> 
> I just want to copy a new file and KEEP the original file modes and 
> ownerships. with fcopy you have -m -M or modes from source file. 
> 
> but It would be nice to have 
> 
>   -k  --keep-modes[=owner,group,modes,time]
>   to keep all or named file stats from the original file  
> 
> i can write a patch if it sounds reasonable.
>

Sorry for leaving this one open for so long, but I'd like to add a few comments
here:

- Of course, this is indeed something useful and a fully acknowledge your
  reasoning.
- BUT: I'm fearing a real overload of fcopy with more and more options for each
  and every need. This will likely irritate users.
- Adding more and more code to fcopy makes it prone to even more bugs and harder
  to fix any of them.
- I guess one can implement your idea in a simple preinst script, which will
  work as soon as your permission-patch gets included:

preinst:
---
#!/bin/sh

chmod --reference=$FAI_ROOT/etc/ssh/sshd_config $2
---

Surely, this is a bit clumsy and not as flexible as =owner,group.modes,time, but
- it is simple
- won't confuse anybody

HTH,
Michael




pgpgPTL9xcjDY.pgp
Description: PGP signature


Re: fcopy feature request: report if a file was copied

2006-12-06 Thread Janning Vygen
Am Mittwoch, 6. Dezember 2006 17:01 schrieben Sie:
> > Am Mittwoch, 6. Dezember 2006 16:13 schrieb Michael Tautschnig:
> > > > hi,
> > > >
> > > > as i use softupdate a lot , it would be nice to have a fcopy feature
> > > > which reports if any files or file permissions were changed. Look at
> > > > my script in BASE/50-ntp
> > >
> > > [...]
> > >
> > > I guess postinst is what you really want (and it is already there,
> > > after all). See the man page.
> >
> > you are right, but
> >
> > - postinst is called for every file which is copied
> > -
>
> Which is what you intended, as I understood it - this does _not_ mean that
> postinst is called for every file that fcopy is run on, but only in those
> cases where the file is _really_ copied, i.e., overwritten.

yes but imagine 
fcopy -ir /etc/postfix/
and i need a postinst script with 
   /etc/init.d/postfix reload

i have to place postinst inside
  /etc/postfix/main.cf/BASE/postinst
  /etc/postfix/master.cf/BASE/postinst
right?

and if i did change master.conf and main.conf postinst would be called two 
times. and what if i have 30 files or more in /etc/postfix like virtual 
tables ...

with my approach it would be

`fcopy -irR /etc/postfix/` -gt "0" && /etc/init.d/postfix reload

(maybe this is not correct bash syntax, just example code )

kind regards
Janning


Re: fcopy feature request: report if a file was copied

2006-12-06 Thread Michael Tautschnig
> Am Mittwoch, 6. Dezember 2006 16:13 schrieb Michael Tautschnig:
> > > hi,
> > >
> > > as i use softupdate a lot , it would be nice to have a fcopy feature
> > > which reports if any files or file permissions were changed. Look at my
> > > script in BASE/50-ntp
> >
> > [...]
> >
> > I guess postinst is what you really want (and it is already there, after
> > all). See the man page.
> 
> you are right, but
> 
> - postinst is called for every file which is copied
> - 
> 

Which is what you intended, as I understood it - this does _not_ mean that
postinst is called for every file that fcopy is run on, but only in those cases
where the file is _really_ copied, i.e., overwritten.

Best,
Michael



pgpMQXkhLyFLJ.pgp
Description: PGP signature


another fcopy feature request -k --keep-modes

2006-12-06 Thread Janning Vygen

sometimes i don't care about the owner:group:modes:timestamp
example /etc/ssh/sshd_config. I just want to copy my content 
to /etc/ssh/sshd_config, but owner, group and modes should be kept.

Of course i can add -m but then i need to know the correct permissions and 
ownership of each file i want to change.

I just want to copy a new file and KEEP the original file modes and 
ownerships. with fcopy you have -m -M or modes from source file. 

but It would be nice to have 

  -k  --keep-modes[=owner,group,modes,time]
  to keep all or named file stats from the original file  

i can write a patch if it sounds reasonable.

kind regards
Janning


Re: fcopy feature request: report if a file was copied

2006-12-06 Thread Janning Vygen
Am Mittwoch, 6. Dezember 2006 16:46 schrieb Janning Vygen:
> Am Mittwoch, 6. Dezember 2006 16:13 schrieb Michael Tautschnig:
> > > hi,
> > >
> > > as i use softupdate a lot , it would be nice to have a fcopy feature
> > > which reports if any files or file permissions were changed. Look at my
> > > script in BASE/50-ntp
> >
> > [...]
> >
> > I guess postinst is what you really want (and it is already there, after
> > all). See the man page.
>
> you are right, but
>
> - postinst is called for every file which is copied

sorry, i clicked return-enter to early. my second reason why i don't like 
postinst:

- its more transparent to have it inside the script which fcopies the files.

kind regards
janning


Re: fcopy feature request: report if a file was copied

2006-12-06 Thread Janning Vygen
Am Mittwoch, 6. Dezember 2006 16:13 schrieb Michael Tautschnig:
> > hi,
> >
> > as i use softupdate a lot , it would be nice to have a fcopy feature
> > which reports if any files or file permissions were changed. Look at my
> > script in BASE/50-ntp
>
> [...]
>
> I guess postinst is what you really want (and it is already there, after
> all). See the man page.

you are right, but

- postinst is called for every file which is copied
- 

> However, the permission thing is obviously not captured (yet).
>
> Best,
> Michael

-- 
PLANWERK 6 websolutions
Venloer Straße 8, 40477 Düsseldorf
Tel: (0211) 302666-0
Fax: (0211) 302666-10 
http://www.planwerk6.de/



Re: fcopy feature request: report if a file was copied

2006-12-06 Thread Michael Tautschnig
> hi,
> 
> as i use softupdate a lot , it would be nice to have a fcopy feature which 
> reports if any files or file permissions were changed. Look at my script in 
> BASE/50-ntp
>
[...]

I guess postinst is what you really want (and it is already there, after all).
See the man page. 

However, the permission thing is obviously not captured (yet).

Best,
Michael



pgp5yRmGlAlET.pgp
Description: PGP signature


Re: fcopy feature request: report if a file was copied

2006-12-06 Thread Janning Vygen
Am Mittwoch, 6. Dezember 2006 15:35 schrieb Thomas Lange:
> >>>>> On Wed, 6 Dec 2006 15:23:58 +0100, Janning Vygen <[EMAIL PROTECTED]>
> >>>>> said:
> >>>>>
> > if [ `fcopy -iM /etc/ntp.conf` -gt "0" ]
> >
> > it would be nice to have an option like
> >  -n --number  report number of files changed
> > and let fcopy report the number of files changed
>
> Good idea. 

thanks.

> But then fcopy must not write any error or verbose messages 
> when using -n. Or should -n report the number of files changes using
> the exit/return code?

we have two options:

- using error code:
i thought about using return code first, but isn't it a little bit 
non-unix-stlye to use exit code for reporting?

- using stdout:
we could print verbose messages to stderr with "warn" and use stdout only for 
reporting number of files. 

i think using stdout is best, just reporting a number.
The script could even build a nice report with "-R full" to send to 
administrator showing diffs and chmod/chown/utime

if you get output with -R something was changed, so you can always reload the 
daemon.

so my proposal would be:

1. send all verbose output to stderr 
2. create a new option

  --report [number|filenames|full|mail]
"number" (default if -R is given): reports number of file
 changes to stdout
"filenames" list all files which has changed one per line
"full" list all files and their differences of content or modes
"mail" sends full report to stdout and [EMAIL PROTECTED]

But i am unsure how to name the option as "-r" is already used, as -l --list 
and -c --count are used, too.

kind regards
Janning



Re: Fcopy patch regarding debian bug report #360184

2006-12-06 Thread Henning Glawe
On Wed, Dec 06, 2006 at 12:01:03PM +0100, Janning Vygen wrote:
> +  return 1 if ( $suid != $duid or $sgid != $dgid or $smode != $dmode or 
> $stime != $dtime );

thinking about (pre/post)inst scripts, comparing the time will lead to
problems... (as destfile may have a different mtime because it has been
modified by one of these scripts).

-- 
c u
henning


Re: fcopy feature request: report if a file was copied

2006-12-06 Thread Thomas Lange
>>>>> On Wed, 6 Dec 2006 15:23:58 +0100, Janning Vygen <[EMAIL PROTECTED]> said:

> if [ `fcopy -iM /etc/ntp.conf` -gt "0" ]

> it would be nice to have an option like 
>  -n --number  report number of files changed
> and let fcopy report the number of files changed 
Good idea. But then fcopy must not write any error or verbose messages
when using -n. Or should -n report the number of files changes using
the exit/return code?

-- 
regards Thomas


Re: Fcopy patch regarding debian bug report #360184

2006-12-06 Thread Janning Vygen
Am Mittwoch, 6. Dezember 2006 15:24 schrieb Henning Glawe:
> On Wed, Dec 06, 2006 at 12:01:03PM +0100, Janning Vygen wrote:
> > +  return 1 if ( $suid != $duid or $sgid != $dgid or $smode != $dmode or
> > $stime != $dtime );
>
> thinking about (pre/post)inst scripts, comparing the time will lead to
> problems... (as destfile may have a different mtime because it has been
> modified by one of these scripts).

that's not a problem in my patch as set_mode is called anyway and only once 
here regardless of the result of compare_modes:

original code in LATEST
set_mode($ps,$destfile,$class);
runscript("postinst",$ps,$destfile,$class);

original code in DEBIAN STABLE is 
postinst($ps,$destfile,$class);
set_mode($ps,$destfile,$class);

so set_mode is called anyway after or before postinst. I dont know why the 
utime is called at all. Is it importand to have the time set to the time of 
the configuration file?

in my opinion all modtime code could be removed, but i kept it as i didn't 
understand it and just wanted to fix the bug.

kind regards,
janning

-- 
PLANWERK 6 websolutions
Venloer Straße 8, 40477 Düsseldorf
Tel: (0211) 302666-0
Fax: (0211) 302666-10 
http://www.planwerk6.de/



fcopy feature request: report if a file was copied

2006-12-06 Thread Janning Vygen
hi,

as i use softupdate a lot , it would be nice to have a fcopy feature which 
reports if any files or file permissions were changed. Look at my script in 
BASE/50-ntp

  #!/bin/sh
  fcopy -iM /etc/ntp.conf
  /etc/init.d/ntp-server stop
  ntpd -q -g
  hwclock --systohc
  /etc/init.d/ntp-server start

I dont want to start and stop my ntp server on each softupdate, only on my 
first install or when /etc/ntp.conf changes

it would be nice to have something like this:

if [ `fcopy -iM /etc/ntp.conf` -gt "0" ]
then
   /etc/init.d/ntp-server stop
   ntpd -q -g
   hwclock --systohc
   /etc/init.d/ntp-server start
fi

it would be nice to have an option like 
 -n --number  report number of files changed
and let fcopy report the number of files changed 

i would like to write a patch for fcopy implementing this if it does make 
sense and would become part of fai.

kind regards 
Janning

-- 
PLANWERK 6 websolutions
Venloer Straße 8, 40477 Düsseldorf
Tel: (0211) 302666-0
Fax: (0211) 302666-10 
http://www.planwerk6.de/



Fcopy patch regarding debian bug report #360184

2006-12-06 Thread Janning Vygen
Hi fai,

attached there are two patch files for fcopy, one for debian stable version 
and one for the latest from fai (which send Thomas Lange to me yesterday)

These Patch files should fix the bug 

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=360184

"In case only the modes are changed, but the actual file stays the same,   
 these changes are not propagated; a possible workaround is IMHO 
 to call set_mode even if a file is preserved."

It just fixes the part of code where $opt_update is not set as i do not 
understood what -p really does.

the main difference is in this line

   if ( compare($tmpfile,$destfile) or compare_mode($ps,$destfile,$class)) {

instead of 

   if ( compare($tmpfile,$destfile) ){

There are a few new subroutines:
   sub get_sourcefile_mode
   sub get_destfile_mode
   sub compare_mode

and some minor modifications to 
  sub set_mode 
to use these new subroutines and avoid repeated code.

It was tested a few times in my environment and it works for me, but maybe 
won't work for you. 

i hope it works and will help anybody. Feel free to use/modify/discard but 
don't claim me for any bugs.

Can anybody review this patch and maybe upload it to http://bugs.debian.org/ 
as i am not used to handle bug reporting databases.

kind regards
Janning

PS: i hope its allowed to send attachments to the list. netiquette is still a 
TODO on 
http://faiwiki.informatik.uni-koeln.de/index.php/Linux-fai_mailing_list_infos

--- fcopy	2006-12-06 11:49:47.306784009 +0100
+++ fcopy.deb31.fixed	2006-12-06 11:47:56.833502527 +0100
@@ -123,8 +123,7 @@
 }
   } else {
 # compare literally
-
-if ( compare($sourcefile,$destfile)) {
+if ( compare($sourcefile,$destfile) or compare_mode($ps,$destfile,$class)) {
   $logcomment="\t# new (literal)";
 } else {
   $logcomment="\t# preserved (literal)" if $logfile;
@@ -187,26 +186,55 @@
 sub set_mode {
 
   # set target file's owner, group, mode and time
-  # use owner,group,mode from -m or from the file file-modes or
-  # use the values from the source file
   my ($sourcefile,$destfile,$class) = @_;
+  my ($uid,$gid,$mode,$stime) = get_sourcefile_mode($sourcefile,$class);
+  warn "chown/chmod u:$uid g:$gid m:$mode $destfile\n" if $debug;
+  chown ($uid,$gid, $destfile) || ewarn("chown $uid, $gid $destfile failed. $!");
+  chmod ($mode, $destfile) || ewarn("chmod $mode $destfile failed. $!");
+  utime ($stime,$stime, $destfile) || ewarn("utime for $destfile failed. $!");
+}
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+sub get_sourcefile_mode {
+
+  # owner,group,mode from -m or from the file file-modes or
+  # the values from the source file
+  my ($sourcefile,$class) = @_;
   my ($uid,$gid,$owner,$group,$mode);
   # get mtime,uid,gid,mode from source file
   my ($stime,@defmodes) = (stat("$sourcefile/$class"))[9,4,5,2];
-
   if ($modeset) { # use -m values
 ($owner,$group,$mode) = @opt_modes;
   } elsif (-f "$sourcefile/file-modes"){
 ($owner,$group,$mode) = read_file_mode("$sourcefile/file-modes",$class);
   } else { # use values from source file
 ($owner,$group,$mode) = @defmodes;
+# see perldoc -f stat
+$mode = $mode & 0;
   }
-
   ($uid,$gid) = name2num($owner,$group);
-  warn "chown/chmod u:$uid g:$gid m:$mode $destfile\n" if $debug; 
-  chown ($uid,$gid, $destfile) || ewarn("chown $owner $group $destfile failed. $!");
-  chmod ($mode, $destfile) || ewarn("chmod $mode $destfile failed. $!");
-  utime ($stime,$stime, $destfile) || ewarn("utime for $destfile failed. $!");
+  return ($uid,$gid,$mode,$stime);
+}
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+sub get_destfile_mode {
+
+  my $destfile = shift;
+  my ($owner,$group,$mode,$time) = (stat($destfile))[4,5,2,9];
+  my ($uid,$gid) = name2num($owner,$group);
+  # see perldoc -f stat
+  $mode = $mode & 0;
+  return ($uid,$gid,$mode,$time);
+}
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+sub compare_mode {
+
+  # compare destination file's mode with source
+  # return 1 if differs / 0 if equals
+  my ($sourcefile,$destfile,$class) = @_;
+  my ($suid,$sgid,$smode,$stime) = get_sourcefile_mode($sourcefile,$class);
+  my ($duid,$dgid,$dmode,$dtime) = get_destfile_mode($destfile);
+
+  return 1 if ( $suid != $duid or $sgid != $dgid or $smode != $dmode or $stime != $dtime );
+  return 0;
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 sub check_mopt {
--- fcopy	2006-12-06 11:19:47.0 +0100
+++ fcopy.fixed	2006-12-06 11:19:47.0 +0100
@@ -145,7 +145,7 @@
   runscript("preinst",$ps,$tmpfile,$class);
 };
 
-if ( compare($tmpfile,$destfile)) {
+if ( compare($tmpfile,$destfile) or compare_mode($ps,$destfile,$class)) {
   $logcomment=

Re: fcopy

2006-12-06 Thread Janning Vygen
Am Dienstag, 5. Dezember 2006 21:04 schrieb Michael Tautschnig:
> > >>>>> On Tue, 5 Dec 2006 15:46:35 +0100, Janning Vygen
> > >>>>> <[EMAIL PROTECTED]> said:
> > >>>>>
> > > If i fcopy a file which is alread there with same content, but the
> > > file in SOURCE has other file access permissions, why it is not
> > > copied?
> >
> > I should be copied, but the permissions should be changed.
> > Which fcopy are you using?
> > Maybe try fcopy -vD to get debuggin and verbose output.
> >
> > > Why does fcopy compares files only literally?
> >
> > Maybe a small bug. But first try -D for debugging output.
> >
> > If you join the IRC channel #fai on oftc.net and paste your output to
> > paste.debian.net we may help you very quickly.
>
> Did you solve this issue already? Otherwise this is probably just what
> #360184 is about:
>
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=360184

Yes, it seams to be the same bug. And it's still there in the newest version. 
IMHO this is a bug to worry about if you use softupdate, which can result in 
a security hole: 

i chmod a script executable in /etc/network/if-pre-up.d/ which contains 
iptables statements. Tthe executable flag was NOT copied and so my firewall 
is not in the state it should be. chmod a script can be an easy way to 
enable/disable a part of a firewall. 

This bug might be only a problem with softupdate of course.

I am debugging fcopy at the moment and will send my patch today.

kind regards,
janning

-- 
PLANWERK 6 websolutions
Venloer Straße 8, 40477 Düsseldorf
Tel: (0211) 302666-0
Fax: (0211) 302666-10 
http://www.planwerk6.de/



Re: fcopy

2006-12-05 Thread Michael Tautschnig
> >>>>> On Tue, 5 Dec 2006 15:46:35 +0100, Janning Vygen <[EMAIL PROTECTED]> 
> >>>>> said:
> 
> > If i fcopy a file which is alread there with same content, but the file 
> in 
> > SOURCE has other file access permissions, why it is not copied?
> I should be copied, but the permissions should be changed.
> Which fcopy are you using?
> Maybe try fcopy -vD to get debuggin and verbose output.
> 
> > Why does fcopy compares files only literally? 
> Maybe a small bug. But first try -D for debugging output.
> 
> If you join the IRC channel #fai on oftc.net and paste your output to
> paste.debian.net we may help you very quickly.
> 
Did you solve this issue already? Otherwise this is probably just what #360184
is about:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=360184

Best,
Michael



pgpahTlDDPFfu.pgp
Description: PGP signature


Re: fcopy

2006-12-05 Thread Thomas Lange
>>>>> On Tue, 5 Dec 2006 15:46:35 +0100, Janning Vygen <[EMAIL PROTECTED]> said:

> If i fcopy a file which is alread there with same content, but the file 
in 
> SOURCE has other file access permissions, why it is not copied?
I should be copied, but the permissions should be changed.
Which fcopy are you using?
Maybe try fcopy -vD to get debuggin and verbose output.

> Why does fcopy compares files only literally? 
Maybe a small bug. But first try -D for debugging output.

If you join the IRC channel #fai on oftc.net and paste your output to
paste.debian.net we may help you very quickly.

-- 
regards Thomas


fcopy

2006-12-05 Thread Janning Vygen
Hi, 

i have read the fcopy man page and didn't find a hint on the following 
problem:

If i fcopy a file which is alread there with same content, but the file in 
SOURCE has other file access permissions, why it is not copied?

I even tried to set the permissions with -m but no way. If the file is given 
and has the same content, nothing is copied but "preserved" as fcopy states.

I would expect fcopy to copy the file if anything like content or permissions 
has changed. Ok, it is somewhat explaind in the -p option but i don't have a 
changelog file.

I have no nfsroot and no cvs, i just rsync my /fai to the remote server and 
run 'fai -N softupdate'. And if i change file access permissions they are not 
copied which is bad in my opinion.

Why does fcopy compares files only literally? 

kind regards
Janning





Re: generating links via fcopy

2005-09-16 Thread Michael Tautschnig
> Hi!
> 
> We'll be using fai to upgrade our Woody workstations to Sarge and
> maintain them. But sometimes we'd like to create links on the target
> machine in the same way, we copy files via fcopy (because we have to
> generate a lot of them).
Isn't it just as easy to create the links in one of your scripts, i.e.

> Example: a relative link is located for example in
> $fairoot/files/etc/mylink.extension/MYCLASS and points to
> ../usr/local/myrealfile.extension. It should be copied as is and
> /etc/mylink.extension should remain as relative link. Current behavior
> is following the link and copying the target file.
> 
fcopy /usr/local/myrealfile.extension && ln -s /usr/local/myrealfile.extension 
${target}/etc/mylink.extension

> We'd like to extend fcopy that it uses readlink/symlink to keep links
> intact if the parameter for example -H is present and the current file
> is a link.
> 
> Has someone did something like this before? Is the dev-team interested
> in the patch?
>

In my opinion, this is somewhat dangerous: It changes the semantics of the
files/ directory, although, of course, only if the -H switch is given.

I'd rather suggest to build a small function:

fcopy_links() {
  local fcopy_args sources eff_sources
  for arg ; do 
if echo $arg | grep -q "^-" then
  fcopy_args="$fcopy_args $arg"
else
  sources="$sources $arg"
fi
  done
  for i in $sources ; do
if [ -L ${FAI}/$i ] ; then
  $eff_sources="$eff_sources $i/`readlink ${FAI}/$i`"
  ln -s $i/`readlink ${FAI}/$i` ${target}/$i
else
  $eff_sources="$eff_sources $i"
fi
  done
  fcopy $fcopy_args $eff_sources
}

HTH,
Michael




generating links via fcopy

2005-09-16 Thread Patrick Cornelißen

Hi!

We'll be using fai to upgrade our Woody workstations to Sarge and
maintain them. But sometimes we'd like to create links on the target
machine in the same way, we copy files via fcopy (because we have to
generate a lot of them).
Example: a relative link is located for example in
$fairoot/files/etc/mylink.extension/MYCLASS and points to
../usr/local/myrealfile.extension. It should be copied as is and
/etc/mylink.extension should remain as relative link. Current behavior
is following the link and copying the target file.

We'd like to extend fcopy that it uses readlink/symlink to keep links
intact if the parameter for example -H is present and the current file
is a link.

Has someone did something like this before? Is the dev-team interested
in the patch?

Bye,
 Patrick Cornelissen



Re: fcopy for single files ?

2005-08-26 Thread Fabrice Pardo

Michael Tautschnig wrote:


[...]

The point is: fcopy (and all other parts of FAI too) uses classes to determine,
which version of a file should be copied, because, e.g., /etc/hostname can't be
the same on all hosts installed with FAI. Thus, all versions of this single file
are kept in one directory /fai/files/etc/hostname and fcopy
determines, which of them has to copied to the host being set up.

Consider the following example: Your hosts are "alpha" and "beta" and you want
to copy /etc/hostname using fcopy. In that case, you need

/fai/files/etc/hostname/alpha and
/fai/files/etc/hostname/beta

Then "fcopy /etc/hostname" will do the job for you.

HTH,
Michael
 


Thanks. It's works as I want now. I was in the bad context of something like

/fai/files/alpha/etc/hostname

/fai/files/beta/etc/hostname

The fcopy message could be more clear for newbees like me, 
distinguishing 2 cases:
if file exists and is not a directory -> "$ps should be a directory 
containing templates"

if not existent -> "inexistent directory: $ps"

Thanks again.

--
Fabrice




Re: fcopy for single files ?

2005-08-26 Thread Michael Tautschnig
> I don't understand if "fcopy" can be used to copy single file.
> 
> Maybe Yes:
> 
> - The is examples in "/usr/share/doc/fai/examples" containing single copy :
> simple/scripts/FAIBASE/10-misc contains "fcopy -i /etc/modules"
> 
> - It seems useful indeed.
> 
> Maybe No:
> 
> - The manual is saying "Each SOURCE argument is a directory"
> 
> - The logs of "successfull installed computers" as
> http://www.informatik.uni-koeln.de/fai/logs/demohost/last-install/shell.log
> show things as
> 
> "fcopy: /fai/files/etc/hostname is not a directory. Not copied."
> 
>
[...]

The point is: fcopy (and all other parts of FAI too) uses classes to determine,
which version of a file should be copied, because, e.g., /etc/hostname can't be
the same on all hosts installed with FAI. Thus, all versions of this single file
are kept in one directory /fai/files/etc/hostname and fcopy
determines, which of them has to copied to the host being set up.

Consider the following example: Your hosts are "alpha" and "beta" and you want
to copy /etc/hostname using fcopy. In that case, you need

/fai/files/etc/hostname/alpha and
/fai/files/etc/hostname/beta

Then "fcopy /etc/hostname" will do the job for you.

HTH,
Michael


fcopy for single files ?

2005-08-26 Thread Fabrice Pardo

I don't understand if "fcopy" can be used to copy single file.

Maybe Yes:

- The is examples in "/usr/share/doc/fai/examples" containing single copy :
simple/scripts/FAIBASE/10-misc contains "fcopy -i /etc/modules"

- It seems useful indeed.

Maybe No:

- The manual is saying "Each SOURCE argument is a directory"

- The logs of "successfull installed computers" as
http://www.informatik.uni-koeln.de/fai/logs/demohost/last-install/shell.log
show things as

"fcopy: /fai/files/etc/hostname is not a directory. Not copied."


Maybe I'm wrong...
or there is some bug somewere ?
I'm talking about fcopy "Version 1.23, 24-march-2005" coming with 
fai_2.8.4_all.deb


--
[EMAIL PROTECTED]
LPN-CNRS, route de Nozay, 91460 Marcoussis (FRANCE)




Re: recursive fcopy for the complete files directory?

2005-06-02 Thread Michael Tautschnig
[...]
> 
> 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
  fi

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

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

  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
  else
tar cfp - --exclude="CVS" --exclude=".svn" --exclude="postinst" * | tar xf 
- -C ${target}/$dir
  fi

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

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

HTH,
Michael


Re: recursive fcopy for the complete files directory?

2005-06-02 Thread Steffen Grunewald
On Thu, Jun 02, 2005 at 12:06:38PM +0200, Henning Sprang wrote:
> On Thu, 2005-06-02 at 10:58 +0200, Henning Glawe wrote:
> > But the major question would be: is this really necessairy?
> 
> Necessary in terms of it doesn't work otherwise, no.
> 
> I agree that I shouldn't think about it any further. I guess I will
> continue to, for some services, store the configuration directory in a
> separate subversion tree and manage it there, checking it out at install
> time.

what about keeping those class-dependent subtrees in a tar, and using
ftar, instead?

Steffen



Re: recursive fcopy for the complete files directory?

2005-06-02 Thread Henning Sprang
On Thu, 2005-06-02 at 10:58 +0200, Henning Glawe wrote:
> But the major question would be: is this really necessairy?

Necessary in terms of it doesn't work otherwise, no.

I agree that I shouldn't think about it any further. I guess I will
continue to, for some services, store the configuration directory in a
separate subversion tree and manage it there, checking it out at install
time.

Henning





Re: recursive fcopy for the complete files directory?

2005-06-02 Thread Henning Glawe
On Thu, Jun 02, 2005 at 10:33:28AM +0200, Henning Sprang wrote:
> /files/etc/fai/
>   fai.conf/
>   UBUNTU-FAI-SERVER
>   FAI-SERVER
>   make-fai-nfsroot.conf/
>   UBUNTU-FAI-SERVER
>   FAI-SERVER
>   menu-lst/
>   UBUNTU-FAI-SERVER
>   FAI-SERVER
>   sources.list/
>   UBUNTU-FAI-SERVER
>   FAI-SERVER
> 
> 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...

not only this, but it would also break consistency of the files/ hierarchy
(which is, btw, already broken if you use the files/packages cruft ;) )

if you want to do something like this, open a new hierarchy and don't use
files/.

But the major question would be: is this really necessairy?

> P.S: I know about ftar, but I wanna do version control - if I put
> *.tar's in the files dir, there's no easy way to get diff's from the
> text files inside.

I'd recommend to use fcopy just as-is...

-- 
c u
henning


Re: recursive fcopy for the complete files directory?

2005-06-02 Thread Henning Sprang
On Thu, 2005-06-02 at 08:51 +0200, Henning Glawe wrote:
> [...]
> thats what fcopy's recursion code is for: I am calling 
> 
> fcopy -i -r .
> 
> in scripts/DEFAULT/S01recursive_fcopy.sh, that means at the really first
> scripts step (the -i sets the exitcode always to 0, because if you are doing
> a recursive fcopy, the probability of some not-matching files is high).
> 
> I am using this construct for at least 3 years now, so it should be pretty
> safe.
> 


Cool, will try that later. Thanks!

Another thing comes to my mind that I wanted to do some time ago, but I
don't remember the correct example back then - maybe the FAI config is a
good one:

For some services, there is not just one file, but a directory with
multiple files in it which belong together as configuration.

Now, if I have for example two different fai configs, say one for a
sarge install server, one for an ubuntu install server, but I want them
to reside on the installed machine in /etc/fai, assuming I never want an
install server that does them both together (which I want finally), I
have to make a setup like this in files:

/files/etc/fai/
fai.conf/
UBUNTU-FAI-SERVER
FAI-SERVER
make-fai-nfsroot.conf/
UBUNTU-FAI-SERVER
FAI-SERVER
menu-lst/
UBUNTU-FAI-SERVER
FAI-SERVER
sources.list/
UBUNTU-FAI-SERVER
FAI-SERVER

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...

P.S: I know about ftar, but I wanna do version control - if I put
*.tar's in the files dir, there's no easy way to get diff's from the
text files inside.

Henning





Re: recursive fcopy for the complete files directory?

2005-06-02 Thread Steffen Grunewald
Hi Henning,

On Wed, Jun 01, 2005 at 10:19:56PM +0200, Henning Sprang wrote:
> Hi, 
> Maybe I miss something, but when I rename some files
> in /usr/local/share/fai/files, I always have to change the corresponding
> script that is responsible for copying this file to it's place.
> 
> Similar double-actions are required when adding or removing a file.
> 
> I would rather like to do a single fcopy command that makes sure every
> file in "files" gets copied to the install client according to matching
> class definitions, so I don't have to take care of anything else then.

I'm using a script to accomplish this which roughly looks this way:
(snipped and pasted)

# install all files available (using fcopy)

filelist=`cd /fai/files; find . -type f -print \
| sed 's-^\./\(.*\)/.*-\1-' | grep -v 'CVS$' | grep -v '^packages' \
| sort | uniq`

# ugly patch: remove /etc/resolv.conf
(cd /tmp/target/etc; /bin/mv -f resolv.conf resolv.conf.BAD)

for file in $filelist ; do
# -B: no backup files! would be included in conf.d directories :(
# -i: ignore "no matching class"
# [-M: default modes: would destroy executables]
# [-v: verbose output, only for debugging]
fcopy -Bi $file
done


The resolv.conf thing is still in there from old days (dunno whether
it's still needed): fcopy would try to follow the symlink and replace
a file in the ro-mounted root.

If you're using SVN, you'd have to extend the find | grep a bit...

> Is something like that available? Or do I forget/oversee something which
> makes this a bad idea?

I've been doing this for quite a long time and nobody complained...
Note that some files would be fcopied before! 

Cheers,
 Steffen

-- 
Steffen Grunewald * MPI fuer Gravitationsphysik (Albert-Einstein-Institut)
SciencePark Golm, Am Mühlenberg 1, D-14476 Potsdam * http://www.aei.mpg.de
* e-mail: steffen.grunewald(*)aei.mpg.de * +49-331-567-{fon:7233,fax:7298}
No Word/PPT mails - http://www.gnu.org/philosophy/no-word-attachments.html



Re: recursive fcopy for the complete files directory?

2005-06-01 Thread Henning Glawe
On Wed, Jun 01, 2005 at 10:19:56PM +0200, Henning Sprang wrote:
> Maybe I miss something, but when I rename some files
> in /usr/local/share/fai/files, I always have to change the corresponding
> script that is responsible for copying this file to it's place.
> 
> Similar double-actions are required when adding or removing a file.
> 
> I would rather like to do a single fcopy command that makes sure every
> file in "files" gets copied to the install client according to matching
> class definitions, so I don't have to take care of anything else then.
> 
> Is something like that available? Or do I forget/oversee something which
> makes this a bad idea?

thats what fcopy's recursion code is for: I am calling 

fcopy -i -r .

in scripts/DEFAULT/S01recursive_fcopy.sh, that means at the really first
scripts step (the -i sets the exitcode always to 0, because if you are doing
a recursive fcopy, the probability of some not-matching files is high).

I am using this construct for at least 3 years now, so it should be pretty
safe.

-- 
c u
henning


Re: recursive fcopy for the complete files directory?

2005-06-01 Thread Michael Tautschnig
> Hi, 
> Maybe I miss something, but when I rename some files
> in /usr/local/share/fai/files, I always have to change the corresponding
> script that is responsible for copying this file to it's place.
> 
> Similar double-actions are required when adding or removing a file.
> 
> I would rather like to do a single fcopy command that makes sure every
> file in "files" gets copied to the install client according to matching
> class definitions, so I don't have to take care of anything else then.
> 
> Is something like that available? Or do I forget/oversee something which
> makes this a bad idea?
>

There shouldn't be any problem, as long as you take care of

- the correct file modes (probably using "file-modes")
- the classes, you are using -- I personally tend to use "DEFAULT" or similar
  classes, that would catch to many hosts, in cases where I know, that my
  scripts only copy it onto the relevant hosts.

AFAIK Henning Glawe just does "fcopy -r" in one of his scripts, so it does work!

Best regards,
Michael


recursive fcopy for the complete files directory?

2005-06-01 Thread Henning Sprang
Hi, 
Maybe I miss something, but when I rename some files
in /usr/local/share/fai/files, I always have to change the corresponding
script that is responsible for copying this file to it's place.

Similar double-actions are required when adding or removing a file.

I would rather like to do a single fcopy command that makes sure every
file in "files" gets copied to the install client according to matching
class definitions, so I don't have to take care of anything else then.

Is something like that available? Or do I forget/oversee something which
makes this a bad idea?


Henning





Crossposting to FAI Lists and Debian BTS - was: "Re: fai: fcopy does not resolve uid/gid"

2005-05-24 Thread Henning Sprang
Hy,
As Thomas already pointed out to me in private mail some time ago: can
we agree that mails to the Debian BTS are not cross-posted to any of the
FAI lists, except it is really so very important that we don't want
anybody to miss the information?

Reason: everybody who has subscribed to the fai package in the Debian
BTS gets these mails twice, and I would like to propose instead, that
everybody interested in the FAI package and all it's bugs just
subscribes the FAI package in the debian BTS.

Because it's really hard to find where to subscribe (at least even I had
to search some minutes - and i just did it last week) - it's there:

http://packages.qa.debian.org/f/fai.html

please let me know if this is an inappropriate idea...
Henning



Re: fai: fcopy does not resolve uid/gid

2005-05-24 Thread Steffen Grunewald
On Tue, May 24, 2005 at 09:24:22AM +0200, Steffen Grunewald wrote:
> On Mon, May 23, 2005 at 08:36:40PM +0200, Michael Tautschnig wrote:
> > diff -rN -u old-MT_FAI/scripts/fcopy new-MT_FAI/scripts/fcopy
> [...]
> > -  my $uid = ($user  =~ /^\d+$/) ? $user  : getpwnam $user;
> > -  my $gid = ($group =~ /^\d+$/) ? $group : getgrnam $group;
> > +  my $uid = ($user  =~ /^\d+$/) ? $user  : `$ENV{ROOTCMD} perl -e '\$uid = 
> > getpwnam $user; print \$uid'`;
> > +  my $gid = ($group =~ /^\d+$/) ? $group : `$ENV{ROOTCMD} perl -e '\$gid = 
> > getgrnam $group; print \$gid'`;
[...]
> I'll try to give it a try... had intended to do a full installation today 
> anyway :-)

Except that the "fcopy" script resides in /usr/sbin (both locally and in
nfsroot), the patch appears to work. And I think that's the proper way...

Thomas, can you put this patch on your list for upcoming versions?
(it might even pass Vorlon's review... thinking about it a bit longer,
this *may* be a critical bug (since it forces the installer to remove
some access limitations to make files accessible at all), feel free to
change the bug level...)

Cheers,
 Steffen

-- 
Steffen Grunewald * MPI fuer Gravitationsphysik (Albert-Einstein-Institut)
SciencePark Golm, Am Mühlenberg 1, D-14476 Potsdam * http://www.aei.mpg.de
* e-mail: steffen.grunewald(*)aei.mpg.de * +49-331-567-{fon:7233,fax:7298}
No Word/PPT mails - http://www.gnu.org/philosophy/no-word-attachments.html



Re: fai: fcopy does not resolve uid/gid

2005-05-24 Thread Michael Tautschnig
> On Mon, May 23, 2005 at 08:36:40PM +0200, Michael Tautschnig wrote:
> > Hi Steffen,
> > 
> > if you're still interested in that problem - could you give the following 
> > patch
> > a try? IMHO the problem is, that logcheck does not exist within your 
> > nfsroot, it
> > only exists on the future client. Thus I'd chroot before doing
> > getpwnam/getgrnam.
> > 
> > diff -rN -u old-MT_FAI/scripts/fcopy new-MT_FAI/scripts/fcopy
> [...]
> > -  my $uid = ($user  =~ /^\d+$/) ? $user  : getpwnam $user;
> > -  my $gid = ($group =~ /^\d+$/) ? $group : getgrnam $group;
> > +  my $uid = ($user  =~ /^\d+$/) ? $user  : `$ENV{ROOTCMD} perl -e '\$uid = 
> > getpwnam $user; print \$uid'`;
> > +  my $gid = ($group =~ /^\d+$/) ? $group : `$ENV{ROOTCMD} perl -e '\$gid = 
> > getgrnam $group; print \$gid'`;
> 
> Will $ROOTCMD be set properly for upgrades?
It's just empty, which should not be a problem (fcopy does not use perl -w, so
not even warnings will be issued).

> 
> I'll try to give it a try... had intended to do a full installation today 
> anyway :-)
>

Thanks!
Michael


Re: fai: fcopy does not resolve uid/gid

2005-05-24 Thread Steffen Grunewald
On Mon, May 23, 2005 at 08:36:40PM +0200, Michael Tautschnig wrote:
> Hi Steffen,
> 
> if you're still interested in that problem - could you give the following 
> patch
> a try? IMHO the problem is, that logcheck does not exist within your nfsroot, 
> it
> only exists on the future client. Thus I'd chroot before doing
> getpwnam/getgrnam.
> 
> diff -rN -u old-MT_FAI/scripts/fcopy new-MT_FAI/scripts/fcopy
[...]
> -  my $uid = ($user  =~ /^\d+$/) ? $user  : getpwnam $user;
> -  my $gid = ($group =~ /^\d+$/) ? $group : getgrnam $group;
> +  my $uid = ($user  =~ /^\d+$/) ? $user  : `$ENV{ROOTCMD} perl -e '\$uid = 
> getpwnam $user; print \$uid'`;
> +  my $gid = ($group =~ /^\d+$/) ? $group : `$ENV{ROOTCMD} perl -e '\$gid = 
> getgrnam $group; print \$gid'`;

Will $ROOTCMD be set properly for upgrades?

I'll try to give it a try... had intended to do a full installation today 
anyway :-)

Cheers,
 Steffen



Re: fai: fcopy does not resolve uid/gid

2005-05-23 Thread Michael Tautschnig
Hi Steffen,

if you're still interested in that problem - could you give the following patch
a try? IMHO the problem is, that logcheck does not exist within your nfsroot, it
only exists on the future client. Thus I'd chroot before doing
getpwnam/getgrnam.

diff -rN -u old-MT_FAI/scripts/fcopy new-MT_FAI/scripts/fcopy
--- old-MT_FAI/scripts/fcopy2005-05-17 15:01:06.0 +0200
+++ new-MT_FAI/scripts/fcopy2005-05-23 20:33:40.0 +0200
@@ -178,8 +178,8 @@
 
   # convert names to numeric uid, gid
   my ($user,$group) = @_;
-  my $uid = ($user  =~ /^\d+$/) ? $user  : getpwnam $user;
-  my $gid = ($group =~ /^\d+$/) ? $group : getgrnam $group;
+  my $uid = ($user  =~ /^\d+$/) ? $user  : `$ENV{ROOTCMD} perl -e '\$uid = 
getpwnam $user; print \$uid'`;
+  my $gid = ($group =~ /^\d+$/) ? $group : `$ENV{ROOTCMD} perl -e '\$gid = 
getgrnam $group; print \$gid'`;
   warn "name2id $user = $uid ; $group = $gid\n" if $debug;
   return ($uid,$gid);
 }

Thanks in advance,
Michael


questions: fcopy, how to encrypt password, network config

2005-05-13 Thread Dan B. Phung
I was able to get fai to install with the 2.6.8 kernel (on client), but
for some reason it's not online (I had assumed it would have used dhcp).  
So in trying to configure fai more, I have some general questions that I
wasn't able to find quickly on google :)

- I see fcopy used with only the source files specified.  e.g.
  fcopy /etc/host.conf /etc/nsswitch.conf /etc/hosts.equiv.

Is the base dir the nfsroot directory?  ie. if I have nfsroot=/diskless_ro
then it's copying from /diskless_ro/etc/host.conf?

- this question might be related to the previous one, but where is the
/etc/network/interfaces that's used?  I want to make sure that dhcp is
used.

- in the FAIBASE.var class, I see the rootpw='56hNVqht51tzc' as default.
How can I easily generate this password?

- I need to specify kernel boot parameters for the installed client
kernel, e.g. I have in my other computers this grub stuff:

title   Debian GNU/Linux, kernel 2.6.8-1-386
root(hd0,0)
kernel  /boot/vmlinuz-2.6.8-1-386 root=/dev/hda1 ro 
console=ttyS1,19200 console=tty0
initrd  /boot/initrd.img-2.6.8-1-386
savedefault
boot

The kernel installed from aptitude automatically generates it's own
config, so how do I add this?  

...I think that's enough questions for now...

cheers,
dan


-- 



Re: fcopy gives permission denied

2005-02-17 Thread Rudy Gevaert
On Tuesday 15 February 2005 17:12, Holger Levsen wrote:
> if the file in /fai/files also has permissions of root,root,0600 then it's
> not readable when exported (try it on the client). You have to loose the
> permissions which might introduce a security breach.

Yes this works.  Thanks



Re: fcopy gives permission denied

2005-02-15 Thread Holger Levsen
Hi,

On Tuesday 15 February 2005 16:36, you wrote:
> gevaert:/home/fai/antldap/last# cat /ed/fai_configdir/scripts/LDAPS
> #!/bin/sh
> fcopy -ir -m root,root,600 /etc/ldap/slapd.conf
>
>
> the shell.log reports:
>
> shell.log:fcopy: copy /fai/files/etc/ldap/slapd.conf/LDAPS to
> /tmp/target/etc/ldap/slapd.conf failed. Permission denied

if the file in /fai/files also has permissions of root,root,0600 then it's not 
readable when exported (try it on the client). You have to loose the 
permissions which might introduce a security breach.


regards,
 Holger


fcopy gives permission denied

2005-02-15 Thread Rudy Gevaert
Hello,

I have the following script:

gevaert:/home/fai/antldap/last# cat /ed/fai_configdir/scripts/LDAPS
#!/bin/sh
fcopy -ir -m root,root,600 /etc/ldap/slapd.conf


the shell.log reports:

shell.log:fcopy: copy /fai/files/etc/ldap/slapd.conf/LDAPS to
/tmp/target/etc/ldap/slapd.conf failed. Permission denied


Why can't I copy that file?  I don't see any problem in the original
file have permissions 600.  And then being replace with a newer file.

Thanks in advance,

Rudy



Re: Passwords in FAI (Was: Re: Copy directories with fcopy)

2005-01-13 Thread Thomas Lange
> On Thu, 13 Jan 2005 14:23:37 +0200, [EMAIL PROTECTED] (Markus Törnqvist) 
> said:

> Must I enable crypts manually somewhere? In which format is the
> default root password after fai? 16-bit MD5?
Password are normal crypt password without using /etc/shadow. This
will change in fai 2.6.6 (comming soon). Have a look at scripts/LAST
in fai 2.6.6 

-- 
regards Thomas



Re: Passwords in FAI (Was: Re: Copy directories with fcopy)

2005-01-13 Thread Steffen Grunewald
On Thu, Jan 13, 2005 at 02:23:37PM +0200, Markus TXrnqvist wrote:
> On Wed, Jan 12, 2005 at 07:05:26PM +0100, Henning Glawe wrote:
> >1) copying passwd is not a good idea: it contains many dynamic entries
> >   generated by packages (and thus changes quite often)
> 
> Well, in this case it's pretty much a good idea :)
> I'd like to company sysadmin team to be able to log in, if they
> change their passwords, it's not an installation problem.

What about having a locked root password and installing your sysadmin
public ssh keys instead?

> Customer accounts are added manually afterwards in either case.

On the YP server, we run a script to extract user accounts (strip
everything with UID below 1000) and upload this to FAIconfig CVS
periodically...

It's still work in progress, but it's quite close: 
http://pandora.aei.mpg.de/cgi-bin/viewcvs.cgi/faiconfig/
Of course, hints are welcome...

Cheers,
 Steffen



Re: Passwords in FAI (Was: Re: Copy directories with fcopy)

2005-01-13 Thread Henning Glawe
On Thu, Jan 13, 2005 at 02:23:37PM +0200, Markus Tïrnqvist wrote:
> On Wed, Jan 12, 2005 at 07:05:26PM +0100, Henning Glawe wrote:
> >1) copying passwd is not a good idea: it contains many dynamic entries
> >   generated by packages (and thus changes quite often)
> 
> Well, in this case it's pretty much a good idea :)
> I'd like to company sysadmin team to be able to log in, if they
> change their passwords, it's not an installation problem.
>
> Customer accounts are added manually afterwards in either case.

but if you install software, the passwd tends to change already: packages
such as ssh create users and/or groups, and the order in which the
installation happens determines the uids; if you later install a non-matching
/etc/passwd, the permissions in the filesystem are garbled.

thats why I use a script to add the necessary account(s) using 'adduser' and
postprocess /etc/passwd afterwards to insert the correct password hashes.

> >2) unless you run fcopy recursively somewhere you need to call it for each
> >   file.
> 
> I made a script like USERS/S666 or something to write the files but
> there's a new problem.
> 
> It doesn't authenticate, no matter what.
> I compared the PAM configuration and all's the same there as on the
> install server, as well as the file contents and permissions.
> 
> Must I enable crypts manually somewhere? In which format is the
> default root password after fai? 16-bit MD5?

this depends on the configuration you are using. try to check $FAI/scripts/*
for things messing around with the passwords...
One quick idea: maybe it is a problem with shadow passwords: if they are
enabled, password hashes are in /etc/shadow and not in /etc/passwd...

-- 
c u
henning


Passwords in FAI (Was: Re: Copy directories with fcopy)

2005-01-13 Thread Markus Törnqvist
On Wed, Jan 12, 2005 at 07:05:26PM +0100, Henning Glawe wrote:
>1) copying passwd is not a good idea: it contains many dynamic entries
>   generated by packages (and thus changes quite often)

Well, in this case it's pretty much a good idea :)
I'd like to company sysadmin team to be able to log in, if they
change their passwords, it's not an installation problem.

Customer accounts are added manually afterwards in either case.

>2) unless you run fcopy recursively somewhere you need to call it for each
>   file.

I made a script like USERS/S666 or something to write the files but
there's a new problem.

It doesn't authenticate, no matter what.
I compared the PAM configuration and all's the same there as on the
install server, as well as the file contents and permissions.

Must I enable crypts manually somewhere? In which format is the
default root password after fai? 16-bit MD5?

So close yet so far ;)

Thanks!

-- 
mjt



Re: Maintaining passwd [was Re: Copy directories with fcopy]

2005-01-12 Thread Henning Glawe
On Wed, Jan 12, 2005 at 06:58:27PM +, Michael Gellman wrote:
> On Wed, 2005-01-12 at 19:05 +0100, Henning Glawe wrote:
> > 1) copying passwd is not a good idea: it contains many dynamic entries
> >generated by packages (and thus changes quite often)
> 
> Can I ask how you handle adding user accounts to systems installed with
> FAI? I currently store my passwd and group file in FAI, and have to make
> sure to manually update it to add new users, which is beginning to
> become an administrative problem. 

well, if the client(s) has got network access, a directory service like nis
or ldap is the best way (from the viewpoint of administrative costs).
if this is not possible, I'd add a script adding the users via adduser, and
substituting the passwords (if needed).

-- 
c u
henning


Maintaining passwd [was Re: Copy directories with fcopy]

2005-01-12 Thread Michael Gellman
On Wed, 2005-01-12 at 19:05 +0100, Henning Glawe wrote:
> 1) copying passwd is not a good idea: it contains many dynamic entries
>generated by packages (and thus changes quite often)

Can I ask how you handle adding user accounts to systems installed with
FAI? I currently store my passwd and group file in FAI, and have to make
sure to manually update it to add new users, which is beginning to
become an administrative problem. 

--Mike



Re: Copy directories with fcopy

2005-01-12 Thread Henning Glawe
On Wed, Jan 12, 2005 at 07:58:20PM +0200, Markus Tïrnqvist wrote:
> nurse:/mnt/z/fai/files/etc# ls -l passwd
> total 4
> -rw-r--r--  1 root root 1463 Jan 10 18:53 USERS
> nurse:/mnt/z/fai/files/etc# ls -ld passwd
> drwxr-xr-x  2 root root 72 Jan 12 18:00 passwd
> 
> Basically I can do it in a separate script, I mean, write the
> passwd and group files, but is this a feature that passwd etc
> are not copied?
> 
> This is mildly annoying :)

1) copying passwd is not a good idea: it contains many dynamic entries
   generated by packages (and thus changes quite often)
2) unless you run fcopy recursively somewhere you need to call it for each
   file.

-- 
c u
henning


Re: Copy directories with fcopy

2005-01-12 Thread Markus Törnqvist
On Fri, Jan 07, 2005 at 01:22:39PM +0100, Thomas Lange wrote:
>fcopy is made for directory structure where you only need to copy a
>couple of files. It's not intended for copying the whole directory
>tree. Therefore you can use ftar(8).

This refuses to work for me:
nurse:/mnt/z/fai/files/etc# ls -l passwd
total 4
-rw-r--r--  1 root root 1463 Jan 10 18:53 USERS
nurse:/mnt/z/fai/files/etc# ls -ld passwd
drwxr-xr-x  2 root root 72 Jan 12 18:00 passwd

Basically I can do it in a separate script, I mean, write the
passwd and group files, but is this a feature that passwd etc
are not copied?

This is mildly annoying :)

Thanks!

-- 
mjt



Re: Copy directories with fcopy

2005-01-07 Thread Ben Willcox

Thomas Lange wrote:
Fine! Seems that you are satisfied with your autom. installation of
your first batch. Can you please fill out the fai questionnaire?
http://www.informatik.uni-koeln.de/fai/questionnaire
I will do that.

fcopy is made for directory structure where you only need to copy a
couple of files. It's not intended for copying the whole directory
tree. Therefore you can use ftar(8).
Thanks, I get it now!
Cheers,
Ben.


Re: Copy directories with fcopy

2005-01-07 Thread Ben Willcox
Steffen Grunewald wrote:
I'm wondering if it's possible to use fcopy to just copy an entire
directory structure for a defined class, rather than creating
directories with the filenames and renaming the actual file as the
classname? I have tried various ways but cannot do it

Could ftar be what you're looking for? (If not, I didn't understand the
problem, which is no surprise at all, it's Friday...)
Yes! Thanks Steffen, didn't even think about that, it works fine.
Cheers,
Ben.


Re: Copy directories with fcopy

2005-01-07 Thread Thomas Lange
>>>>> On Fri, 07 Jan 2005 11:56:22 +, Ben Willcox <[EMAIL PROTECTED]> said:

> Hi there,
> Trying to use FAI again for a second batch of computers with a new
> configuration.
Fine! Seems that you are satisfied with your autom. installation of
your first batch. Can you please fill out the fai questionnaire?
http://www.informatik.uni-koeln.de/fai/questionnaire


> I'm wondering if it's possible to use fcopy to just copy an entire
> directory structure for a defined class, rather than creating
> directories with the filenames and renaming the actual file as the
> classname? I have tried various ways but cannot do it
fcopy is made for directory structure where you only need to copy a
couple of files. It's not intended for copying the whole directory
tree. Therefore you can use ftar(8).

-- 
regards Thomas


Re: Copy directories with fcopy

2005-01-07 Thread Steffen Grunewald
On Fri, Jan 07, 2005 at 11:56:22AM +, Ben Willcox wrote:
> Hi there,
> 
> Trying to use FAI again for a second batch of computers with a new
> configuration.
> 
> I'm wondering if it's possible to use fcopy to just copy an entire
> directory structure for a defined class, rather than creating
> directories with the filenames and renaming the actual file as the
> classname? I have tried various ways but cannot do it

Could ftar be what you're looking for? (If not, I didn't understand the
problem, which is no surprise at all, it's Friday...)

Steffen



Copy directories with fcopy

2005-01-07 Thread Ben Willcox
Hi there,
Trying to use FAI again for a second batch of computers with a new
configuration.
I'm wondering if it's possible to use fcopy to just copy an entire
directory structure for a defined class, rather than creating
directories with the filenames and renaming the actual file as the
classname? I have tried various ways but cannot do it
I hope what I'm asking makes sense, but from what I understand the way
the /fai/files directory works is you will build a common file
structure, which contains class specific files within that structure.
To me that seems a little confusing when you have many different types
of machine build, and more importantly it is a lot of work creating
directories as the filename and renaming files etc, when there are many
files in there - it would seem easier if I could create a separate
subdirectory within /fai/files per class, and then have a filestructure
underneath that which would get copied to the relevent client machines.
Perhaps I am using FAI incorrectly, but I would normally build one
machine manually and get it working to my desired spec, and then try to
configure FAI to install the same config to my fresh batch of machines.
What I would like to do is directly copy the config files from /etc or
wherever on my manually installed machine to the FAI server using scp,
and then FAI copies these back to the auto installed machines using the
same directory structure.
Is this the correct way to do it?
Thanks,
Ben.



Re: fcopy problem

2004-11-29 Thread Steffen Grunewald
On Sun, Nov 28, 2004 at 06:16:24PM +0100, Holger Levsen wrote:
> As a workaround you can do a "$ROOTCMD chgrp" afterwards... but:  please fill 
> a bug in the debian BTS (bug tracking system, http://bugs.debian.org) to help 
> Thomas _and_others_.

Good point, done.

S



Re: fcopy problem

2004-11-29 Thread Holger Levsen
Hi,

> The problem I can see is that within /usr/sbin/fcopy, the name2num
> subroutine does not properly return the gid for group logcheck because
> in the install system there isn't such a group - although it should
> better look in the target system. The result is that the file
> permissions are set, the owner (root) is set, but the group pertains to
> be root too, so logcheck won't be able to access the file, causing the
> exclusion to fail.

> Any ideas?

As a workaround you can do a "$ROOTCMD chgrp" afterwards... but:  please fill 
a bug in the debian BTS (bug tracking system, http://bugs.debian.org) to help 
Thomas _and_others_.


regards,
 Holger


fcopy problem

2004-11-26 Thread Steffen Grunewald
Hi,

I'd like to add some exclusion rules for logcheck, and put them into
/etc/logcheck/ignore.d.server/ subdirectories. I also added file-modes
files (with root logcheck 0640 in them).
The problem I can see is that within /usr/sbin/fcopy, the name2num
subroutine does not properly return the gid for group logcheck because
in the install system there isn't such a group - although it should
better look in the target system. The result is that the file
permissions are set, the owner (root) is set, but the group pertains to
be root too, so logcheck won't be able to access the file, causing the
exclusion to fail.
Of course, a simple workaround would be to set the permissions to 644,
and ignore the group settings - but I could imagine that under certain
circumstances this feature might be more important (SSL web server etc.)

The "getpwnam"/"getgrnam" calls should work in the target environment
instead of the install env...

Any ideas?

Cheers,

 Steffen

-- 
Steffen Grunewald * * * Merlin cluster admin (http://pandora.aei.mpg.de)
Albert-Einstein-Institut (MPI Gravitationsphysik, http://www.aei.mpg.de)
   Science Park Golm, Am Mühlenberg 1, 14476 Potsdam, Germany
e-mail: steffen.grunewald(*)aei.mpg.de * +49-331-567-{fon:7233,fax:7298}



Re: fcopy and ignoring .svn directories when copying recursively

2004-11-10 Thread Henning Glawe
On Fri, Nov 05, 2004 at 11:12:31AM +0100, Steffen Grunewald wrote:
> If (as I suppose) subversion internal information is stored in a .svn/
> directory in every subdir of the tree, then the fifth line should be
> replaced by
> 
> -d && ! ($_ =~ /^.*CVS$/) && ! ($_ =~ /^.*\.svn/) && ($nlink=(lstat($_))[3]) 
> &&
> 
> (question to Thomas: shouldn't there be a \/ prepended to CVS - and .svn ?)

To answer the question (this messy bit of code was one of my first
contributions to FAI...):
when using File::Find, $_ only contains the basename, not the complete path,
so matching on '/' would break the code.

the attached patch (already submitted to thomas) contains a clean solution:
it cleans up the code, making it actually readable and makes the list of
ignored directories configurable.

-- 
c u
henning
--- orig/man/fcopy.8
+++ mod/man/fcopy.8
@@ -65,6 +65,11 @@
 .B \-i
 Ignore warnings about no matching class and always exit with 0.
 .TP
+.BI "\-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).
+.TP
 .B \-l
 Do not copy if destination is a symbolic link
 .TP
@@ -101,7 +106,7 @@
 .B \-r
 Copy recursively (traverse down the tree).  Copy all files below
 SOURCE.  These are all subdirectory leaves in the SOURCE tree.  Ignore
-CVS directories.
+"ignored" directories (see "\-I" for details).
 .TP
 .BI "\-s " source_dir
 Look for SOURCE files relative to \fIsource_dir\fR.  Use $FAI/files if


--- orig/scripts/fcopy
+++ mod/scripts/fcopy
@@ -57,10 +57,12 @@
 my $nobackup;
 my $opt_update;
 my $backupdir;
+my @ignoredirs = qw'CVS .svn .arch-ids {arch}';
 
 # getopts:
 our ($opt_s, $opt_t, $opt_r, $opt_m, $opt_M, $opt_v, $opt_d, $opt_D, $opt_i);
 our ($opt_B, $opt_c, $opt_C, $opt_h, $opt_F, $opt_l, $opt_L, $opt_P, $opt_b);
+our $opt_I;
 
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 sub copy_one {
@@ -322,13 +324,14 @@
-F file  Read list of sources from file.
-h   Show summary of options.
-i   Exit with 0 when no class applies.
+   -I dir[,dir] Override default list of ignored subdirectories
-l   Do not copy if destination is a symbolic link.
-L file  Log destination and used class to file
-m user,group,mode   Set user, group and mode for copied files.
-M   Same as -m root,root,0644
-P log,changes   Copy if class or source for class has changed since
 previous run
-   -r   Copy recursivly but skip CVS directories.
+   -r   Copy recursivly but skip ignored directories.
-s source_dirLook for source files relative to source_dir.
-t target_dirCopy files relativ to target_dir.
-b backup_dirWhere to save backups of overwritten files
@@ -342,16 +345,21 @@
 sub rfilter {
 
   # Filter for recursive copying
-  my $nlink;
-  -d && ! ($_ =~ /^CVS$/) && ($nlink=(lstat($_))[3]) && 
-( (-d 'CVS') && ($nlink==3) || ($nlink==2) ) && 
-  push @rlist,$File::Find::name;
+  
+  # are we in a directory ? should we ignore it ?
+  my $location=$_;
+  (-d and (! grep $location eq $_,@ignoredirs )) or return 0;
+  # a directory without subdirs has two hard links
+  # don't count @ignoredirs as subdirs
+  my $subdirs=(lstat($_))[3] - 2 - grep(-d,@ignoredirs);
+  # push leaf
+  push @rlist,$File::Find::name unless $subdirs;
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 # main program
 
 $|=1;
-getopts('Ms:t:rm:vidDc:C:hF:lL:P:Bb:');
+getopts('Ms:t:rm:vidDc:C:hF:lL:P:Bb:I:');
 $opt_h && usage;
 $opt_M and $opt_m="root,root,0644";  # set default modes
 $opt_m && check_mopt();
@@ -380,6 +388,9 @@
 $opt_C and @classes = read_classes($opt_C);
 warn join ' ','Classes:',@classes,"\n" if $debug;
 $opt_F and @ARGV = read_files($opt_F);
+$ENV{'FCOPY_IGNOREDIRS'} and @ignoredirs = split 
/\s+/,$ENV{'FCOPY_IGNOREDIRS'};
+$opt_I and @ignoredirs = split /,/,$opt_I;
+
 die "fcopy: source undefined\n" unless $source;
 die "fcopy: target undefined\n" unless $target;
 



Summary: provide a more intelligent mechanism to ignore dirs in fcopy
Keywords: fcopy feature

- rewrite rfilter to check against a list @ignoredirs
- initialize @ignoredirs for config managed in CVS, subversion and GNU arch
- include command line option "-I blah[,blubb]" and environment variable 
  $FCOPY_IGNOREDIRS to override @ignoredirs
- comment the code and make it understandable (YEAH!)

provide a more intelligent mechanism to ignore dirs in fcopy

Re: fcopy and ignoring .svn directories when copying recursively

2004-11-05 Thread Steffen Grunewald
Hi,

On Fri, Nov 05, 2004 at 09:41:11AM -, [EMAIL PROTECTED] wrote:
> I've tried with the backslashed escape, but it has no effect. Is there
> anything else I can try?
> >> sub rfilter {
> >>
> >>   # Filter for recursive copying
> >>   my $nlink;
> >>   -d && ! ($_ =~ /^.*CVS$/) && ($nlink=(lstat($_))[3]) &&
> >> ( (-d 'CVS') && ($nlink==3) || ($nlink==2) ) &&
> >>   push @rlist,$File::Find::name;
> >> }

If (as I suppose) subversion internal information is stored in a .svn/
directory in every subdir of the tree, then the fifth line should be
replaced by

-d && ! ($_ =~ /^.*CVS$/) && ! ($_ =~ /^.*\.svn/) && ($nlink=(lstat($_))[3]) &&

(question to Thomas: shouldn't there be a \/ prepended to CVS - and .svn ?)

Cheers,
 Steffen

-- 
Steffen Grunewald * * * Merlin cluster admin (http://pandora.aei.mpg.de)
Albert-Einstein-Institut (MPI Gravitationsphysik, http://www.aei.mpg.de)
   Science Park Golm, Am Mühlenberg 1, 14476 Potsdam, Germany
e-mail: steffen.grunewald(*)aei.mpg.de * +49-331-567-{fon:7233,fax:7298}



Re: fcopy and ignoring .svn directories when copying recursively

2004-11-05 Thread stan


Aplolgies, but I have checked the script that the test install client was
running and the fcopy script was not the amended one.

I am now testing re-install with the amended script and will keep the list
informed as to my results.

thanks

Stephen

>
> Hi Geert,
>
> Thank you for your response.
>
> I've tried with the backslashed escape, but it has no effect. Is there
> anything else I can try?
>
> (If this does not work, I will have to individually specify each file that
> I need to fcopy in a shell script with a for statement. This is messy and
> I would like to avoid this.)
>
> Here is some sample output from fcopy when it hits the .svn dirs:
>
>
> fcopy: no matching file for any class for root/.profile/.svn/tmp/wcprops
> defined.
> fcopy: no matching file for any class for root/.profile/.svn/tmp/props
> defined.
> fcopy: no matching file for any class for root/.profile/.svn/tmp/prop-base
> defined.
> fcopy: no matching file for any class for root/.profile/.svn/tmp/text-base
> defined.
>
> thanks
>
> Stephen
>
>> On Thu, Nov 04, 2004 at 01:46:46PM -, [EMAIL PROTECTED] wrote:
>>>
>>> Hi
>>>
>>> I'm using subversion to  keep tabs of the /usr/local/share/fai
>>> directory,
>>> but have run into a problem when using fcopy recursively.
>>>
>>> I know that fcopy is set to ignore CVS files/dirs (it says so in the
>>> man
>>> page) so I tried to hack the perl from /usr/sbin/fcopy to accomodate
>>> .svn
>>> dirs. However, I can't seem to get the code to ignore .svn files! (My
>>> perl
>>> is not great.)
>>>
>>> Here is the code:
>>>
>>> sub rfilter {
>>>
>>>   # Filter for recursive copying
>>>   my $nlink;
>>>   -d && ! ($_ =~ /^.*CVS$/) && ($nlink=(lstat($_))[3]) &&
>>> ( (-d 'CVS') && ($nlink==3) || ($nlink==2) ) &&
>>>   push @rlist,$File::Find::name;
>>> }
>>>
>>> I have replaced CVS with '.'svn but when I run fcopy, my .svn files are
>>> not ignored and the fcopy fails.
>>>
>>> What am I doing wrong?
>>
>> try  \.svn  (  a dot is a wildcard, the backslash escapes it )
>>
>>> thanks in advance. (Danke!)
>>
>> Report your results back.
>>
>>>
>>> Stephen
>>
>> Geert Stappers
>>
>
>



Re: fcopy and ignoring .svn directories when copying recursively

2004-11-05 Thread stan

Hi Geert,

Thank you for your response.

I've tried with the backslashed escape, but it has no effect. Is there
anything else I can try?

(If this does not work, I will have to individually specify each file that
I need to fcopy in a shell script with a for statement. This is messy and
I would like to avoid this.)

Here is some sample output from fcopy when it hits the .svn dirs:


fcopy: no matching file for any class for root/.profile/.svn/tmp/wcprops
defined.
fcopy: no matching file for any class for root/.profile/.svn/tmp/props
defined.
fcopy: no matching file for any class for root/.profile/.svn/tmp/prop-base
defined.
fcopy: no matching file for any class for root/.profile/.svn/tmp/text-base
defined.

thanks

Stephen

> On Thu, Nov 04, 2004 at 01:46:46PM -, [EMAIL PROTECTED] wrote:
>>
>> Hi
>>
>> I'm using subversion to  keep tabs of the /usr/local/share/fai
>> directory,
>> but have run into a problem when using fcopy recursively.
>>
>> I know that fcopy is set to ignore CVS files/dirs (it says so in the man
>> page) so I tried to hack the perl from /usr/sbin/fcopy to accomodate
>> .svn
>> dirs. However, I can't seem to get the code to ignore .svn files! (My
>> perl
>> is not great.)
>>
>> Here is the code:
>>
>> sub rfilter {
>>
>>   # Filter for recursive copying
>>   my $nlink;
>>   -d && ! ($_ =~ /^.*CVS$/) && ($nlink=(lstat($_))[3]) &&
>> ( (-d 'CVS') && ($nlink==3) || ($nlink==2) ) &&
>>   push @rlist,$File::Find::name;
>> }
>>
>> I have replaced CVS with '.'svn but when I run fcopy, my .svn files are
>> not ignored and the fcopy fails.
>>
>> What am I doing wrong?
>
> try  \.svn  (  a dot is a wildcard, the backslash escapes it )
>
>> thanks in advance. (Danke!)
>
> Report your results back.
>
>>
>> Stephen
>
> Geert Stappers
>



Re: fcopy and ignoring .svn directories when copying recursively

2004-11-04 Thread Geert Stappers
On Thu, Nov 04, 2004 at 01:46:46PM -, [EMAIL PROTECTED] wrote:
> 
> Hi
> 
> I'm using subversion to  keep tabs of the /usr/local/share/fai directory,
> but have run into a problem when using fcopy recursively.
> 
> I know that fcopy is set to ignore CVS files/dirs (it says so in the man
> page) so I tried to hack the perl from /usr/sbin/fcopy to accomodate .svn
> dirs. However, I can't seem to get the code to ignore .svn files! (My perl
> is not great.)
> 
> Here is the code:
> 
> sub rfilter {
> 
>   # Filter for recursive copying
>   my $nlink;
>   -d && ! ($_ =~ /^.*CVS$/) && ($nlink=(lstat($_))[3]) &&
> ( (-d 'CVS') && ($nlink==3) || ($nlink==2) ) &&
>   push @rlist,$File::Find::name;
> }
> 
> I have replaced CVS with '.'svn but when I run fcopy, my .svn files are 
> not ignored and the fcopy fails.
> 
> What am I doing wrong?

try  \.svn  (  a dot is a wildcard, the backslash escapes it )

> thanks in advance. (Danke!)

Report your results back.

> 
> Stephen

Geert Stappers


signature.asc
Description: Digital signature


fcopy and ignoring .svn directories when copying recursively

2004-11-04 Thread stan

Hi

I'm using subversion to  keep tabs of the /usr/local/share/fai directory,
but have run into a problem when using fcopy recursively.

I know that fcopy is set to ignore CVS files/dirs (it says so in the man
page) so I tried to hack the perl from /usr/sbin/fcopy to accomodate .svn
dirs. However, I can't seem to get the code to ignore .svn files! (My perl
is not great.)

Here is the code:

sub rfilter {

  # Filter for recursive copying
  my $nlink;
  -d && ! ($_ =~ /^.*CVS$/) && ($nlink=(lstat($_))[3]) &&
( (-d 'CVS') && ($nlink==3) || ($nlink==2) ) &&
  push @rlist,$File::Find::name;
}

I have replaced CVS with '.'svn but when I run fcopy, my .svn files are 
not ignored and the fcopy fails.

What am I doing wrong?

thanks in advance. (Danke!)

Stephen






Re: fcopy: "file-modes" for directories?

2004-11-02 Thread Harald Staub
Hello Holger
install -m 0700 -d $target/some/dir ?
fcopy /some/dir/somefile
Sorry, I did not tell you the idea behind.  I try to be more in line with 
Henning Glawe's patched fai: I call fcopy just once: fcopy -B -r /

This is not really important now, but it might be easier in the future to 
convert the fai setup to maintain configurations of running systems.

Cheers
 Harry


Re: fcopy: "file-modes" for directories?

2004-11-02 Thread Holger Schurig
> for directories instead of plain files?  Is there a reason why this
> would not make sense, or am I just the first one who could use this

Maybe it makes sense, but maybe you can help yourself with this:

install -m 0700 -d $target/some/dir ?
fcopy /some/dir/somefile



fcopy: "file-modes" for directories?

2004-11-02 Thread Harald Staub
As you know, fcopy has the capability to chown/chmod copied files using an 
additional file-modes file.  Has anybody out there ever missed this for 
directories instead of plain files?  Is there a reason why this would not 
make sense, or am I just the first one who could use this feature?

Cheers
 Harry


Re: fcopy and classes?

2002-01-12 Thread Thomas Lange

>>>>> On Sat, 12 Jan 2002 20:15:40 +0100, Christoph Keller <[EMAIL PROTECTED]> 
>said:

> Hello, is there any way to tell fcopy to use the file which
> matches the class at the beginning?  The Problem is that for
> some host I need a different config file all other hosts have
> one config.  I set extra classes in the host file but in

Why not using the hostname class ? The priority in FAI_CLASSES and
$classes is from low to high. DEFAULT is the first class with the
lowest priority. At the end the class with the hostname is of high
priority. The class LAST has the highest priority but should not be
used for fcopy. So put all your hosts into the class EXAMPLE2 and
create a config file with the hostname and this will be used by
fcopy. Also try fcopy -vD to get debug output.

You can also influence the order of defined classes by creating new
scripts in /fai/class/.

-- 
 Thomas



fcopy and classes?

2002-01-12 Thread Christoph Keller


Hello,
is there any way to tell fcopy to use the file which matches the class
at the beginning?
The Problem is that for some host I need a different config file all
other hosts have one config.
I set extra classes in the host file but in FAI_CLASSES the class I
definded in the host-file appears at the beginning. 
So for fcopy the priority for this file is less than that for all hosts.
This is not what I want. Or do I use fcopy the wrong way?

Christoph
-- 



new command fcopy; first version

2001-01-08 Thread Thomas Lange

fcopy, a new command for copying file with classes is available.
Using fcopy, all copy sections in the cfengine scripts will be obsolete.
There's also a manual page available. Please look at it, and send me
any comment on it. 

fcopy is available at:

http://www.informatik.uni-koeln.de/fai/download

It will be available in the CVS repository next
week and in the next FAI version (not available the next week ;-).

-- 
 Thomas
--
Thomas Lange
Institut fuer Informatikmailto:[EMAIL PROTECTED]
   Universitaet zu Koeln
Pohligstr. 1Telefon: +49 221 470 5303
 50969 KoelnFax: +49 221 470 5317

1024D/AB9B66FD AEA6 A8C1 BD8E 67C4 8EF6  8BCA DC13 E54E AB9B 66FD
--