I just found the problem:

file /var/lib/fai/config/scripts/NFS_CLIENT/10-create-directories
/var/lib/fai/config/scripts/NFS_CLIENT/10-create-directories: awk script, ASCII text

file -m /usr/share/file/magic.mgc /var/lib/fai/config/scripts/NFS_CLIENT/10-create-directories /var/lib/fai/config/scripts/NFS_CLIENT/10-create-directories: Perl script, ASCII text executable

=> file seems to use now a different magic.mgc :-( ...
Looking for it I found it in /usr/local/share/misc/magic.mgc

file -m /usr/local/share/misc/magic.mgc /var/lib/fai/config/scripts/NFS_CLIENT/10-create-directories /var/lib/fai/config/scripts/NFS_CLIENT/10-create-directories: awk script, ASCII text


I guess I messed up the installation, because configure used by default "/usr/local" as prefix (I didnt expect this), hence file was linked to /usr/local/...instead of /usr/... and the files were created there ...

After fixing this, file uses /usr/share/file/magic.mgc (created with patched packages) and works as expected
file /var/lib/fai/config/scripts/NFS_CLIENT/10-create-directories
/var/lib/fai/config/scripts/NFS_CLIENT/10-create-directories: Perl script, ASCII text executable

Thanks a lot!
René

PS: I attached the script I used to test

On 03/24/2014 10:10 AM, Christoph Biedl wrote:
René Bleisch wrote...

I applied the patch, but it didnt fix the issue ...
Not good, but it still works for me. Is the 10-create-directories
script available? Using the sniplet you mentioned in the FAI list:

--------------------
#!/usr/bin/perl -w
use strict;

BEGIN {
    if ( !$ENV{'PERL_MODULES'} ) {
       $ENV{'PERL_MODULES'}= '/srv/fai/config/perl_modules';
    }
    unshift @INC, $ENV{'PERL_MODULES'};
}

use FAI;
use NFS::Clients;
--------------------

the patch changes recognition to "Perl script, ASCII text executable"

So I suspect something went wrong when you applied the patch although
I cannot see what.

Second try:
- cd file-5.11
- rebuild the package with debuild -i -us -uc -b
- dpkg -i file_5.11-2+deb7u2_amd64.deb
- dpkg -i libmagic1_5.11-2+deb7u2_amd64.deb
For a test: Extract magic.mgc from the libmagic package to /tmp, then
try:

$ file -m /tmp/magic.mgc <file-to-test>

Still a avail? Try these:

$ file --list -m /usr/share/file/magic.mgc | grep awk
$ file --list -m /tmp/magic.mgc | grep awk

The last line should be different, "Strength =  45" instead of 57
indicates a fixed magic.

md5sums (for amd64)

2a759ba7b571408a4a1134840998327c  /usr/share/file/magic.mgc
15984645e3f69bd207a917b4f944a8b2  /tmp/magic.mgc

where /usr/share/file/magic.mgc is from the recently deployed version
(5.11-2+deb7u2).

Hope that helps,

     Christoph


--
Dr. René Bleisch
University of Bern
Climate and Environmental Physics
Sidlerstr.5
3012 Bern
Switzerland

Phone: +41 31 631 34 02
Mail: [email protected]

#!/usr/bin/perl -w
use strict;

BEGIN {
   if ( !$ENV{'PERL_MODULES'} ) {
      $ENV{'PERL_MODULES'}= '/srv/fai/config/perl_modules';
   }
   unshift @INC, $ENV{'PERL_MODULES'};
}

use FAI;
use NFS::Clients;

NFS_SERVER:
foreach my $nfs_server (sort keys %data_partitions) {
   next if $nfs_server eq $HOSTNAME;             # only for client machines

   # check whether this host is in server ignore_clients
   foreach my $ignore ( @{$data_partitions{$nfs_server}{'ignore_clients'}} ) {
      next NFS_SERVER if $HOSTNAME eq $ignore;
   }

   # check wheter whitelist_clients exists. if it does, the client must
   # be listed there
   if ( defined @{$data_partitions{$nfs_server}{'whitelist_clients'}} ) {
      my $is_in_whitelist = 0;
      foreach my $whitelist ( 
@{$data_partitions{$nfs_server}{'whitelist_clients'}} ) {
         $is_in_whitelist++ if $HOSTNAME eq $whitelist;
      }
      next unless $is_in_whitelist;
   }

   PARTITION:
   foreach my $partition ( sort keys %{$data_partitions{$nfs_server}} ) {

      # all partitions begin with a forward-slash
      # other entries (such as 'ignore_clients") do not
      next PARTITION if $partition !~ m{^/};
   
      # check whether this host is in partition ignore_clients
      foreach my $ignore ( 
@{$data_partitions{$nfs_server}{$partition}{'ignore_clients'}} ) {
         next PARTITION if $HOSTNAME eq $ignore;
      }
      # check wheter whitelist_clients exists. if it does, the client must
      # be listed there
      if ( defined 
@{$data_partitions{$nfs_server}{$partition}{'whitelist_clients'}} ) {
         my $is_in_whitelist = 0;
         foreach my $whitelist ( 
@{$data_partitions{$nfs_server}{$partition}{'whitelist_clients'}} ) {
            $is_in_whitelist++ if $HOSTNAME eq $whitelist;
         }
         next unless $is_in_whitelist;
      }

      my $mountpoint = $data_partitions{$nfs_server}{$partition}{'mountpoint'}
         || $partition;
      $mountpoint = "$FAI_ROOT/$mountpoint";
      $mountpoint =~ s{//+}{/}g;
      my $permissions = 
$data_partitions{$nfs_server}{$partition}{'permissions'} || '01777';
      if ( !-d $mountpoint ) {
         print "Creating directory $mountpoint...\n";
         mkdir "$mountpoint", 0755
            or die "Cannot create $mountpoint: $!\n";
         if ( ! chmod oct($permissions), $mountpoint ) {
            warn "Could not chmod $mountpoint: $!\n";
         }
      }
   }
}

Reply via email to