Andrea,

using -exec instead of xargs is not working properly on the first
call to find.  It removes the directory $vg_name and all it's contents,
but exits with status 1.  die( "Couldn't $cmd" ) catches this and
kills the script.

This is something wierd about find/-exec with rm -rf: 

hvxen-0c:~ # find /tmp/.systemimager.2/dev/ -name "system" -type d -exec rm 
-rfv \{} \;
removed `/tmp/.systemimager.2/dev/system/tmp'
removed `/tmp/.systemimager.2/dev/system/var'
removed `/tmp/.systemimager.2/dev/system/usr'
removed `/tmp/.systemimager.2/dev/system/home'
removed directory: `/tmp/.systemimager.2/dev/system'
find: /tmp/.systemimager.2/dev/system: No such file or directory
hvxen-0c:~ # echo $?
1

The second call to find just uses rm -f. this succeeds without errors.



On Mon, Mar 13, 2006 at 10:42:58PM +0100, Andrea Righi wrote:
> Ashley,
> 
> thanks! seems good and not yet checked into SVN... anyway I'd propose to
> change it, if you agree, as following:
> 
> #
> # Remove LVM device mapper files from $staging_dir/dev
> #
> $cmd = qq(vgs --noheadings --options vg_name 2>/dev/null);
> open(VG, "$cmd|");
> foreach my $vg_name (<VG>) {
>         chomp $vg_name;
>         $vg_name =~ s/^\s+//;
>         $cmd = "find $staging_dir/dev/ -name \"$vg_name\" -type d -exec
> rm -rf {} \\;";
>         !system( $cmd ) or die( "Couldn't $cmd" );
>         $cmd = "find $staging_dir/dev/mapper -name \"$vg_name-*\" -type
> b -exec rm -f {} \\;";
>         !system( $cmd ) or die( "Couldn't $cmd" );
> }
> close(VG);
> 
> In particular removing the '*' after $vg_name and being more selective,
> to obviate the deletion of other potential useful files... for example
> think if I want to create a volume group called 'sd'... ;-).
> 
> Best regards,
> -Andrea
> 
> Ashley Gould wrote:
> > First off let me say the 3.6.2-1 rpms work beautifully on SLES9 x86-64.
> > I only encountered this one problem.  Great Work!
> > 
> > Creation of LVM volume groups fail during autinstall because
> > device mapper cannot create /dev/mapper/<vg_name> files - they
> > already exist in initrd.
> > 
> > When si_prepareclient compiles files for the UYOK initrd.img, it
> > copies all of dev, including files previously created by LVM device mapper
> > (e.g. /dev/system).  Trouble is when autoinstall scripts attempt to
> > create the 'system' volume group, it fails because the /dev/system
> > directory already exists.
> > 
> > 
> > I added a piece of code to UseYourOwnKernel.pm which strips these out:
> > 
> > hvxen-0c:~ # diff -Naur 
> > /usr/lib/systemimager/perl/SystemImager/UseYourOwnKernel.pm 
> > /usr/lib/systemimager/perl/SystemImager/UseYourOwnKernel.pm.dist 
> > --- /usr/lib/systemimager/perl/SystemImager/UseYourOwnKernel.pm 2006-03-13 
> > 12:03:24.807846378 -0800
> > +++ /usr/lib/systemimager/perl/SystemImager/UseYourOwnKernel.pm.dist    
> > 2006-03-13 11:27:00.047854543 -0800
> > @@ -97,19 +97,6 @@
> >          $cmd = qq(rsync -a /dev/ $staging_dir/dev/);
> >          !system( $cmd ) or die( "Couldn't $cmd." );
> >  
> > -        #
> > -        # Remove LVM device mapper files from $staging_dir/dev
> > -        #
> > -        $cmd = qq(vgs --noheadings --separator S --options vg_name 
> > 2>/dev/null);
> > -        open(VG, "$cmd|");
> > -        foreach my $vg_name (<VG>) {
> > -            chomp $vg_name;
> > -            $vg_name =~ s/^\s+//;
> > -            my $find_cmd = qq(find $staging_dir/dev/ -name "$vg_name*" | 
> > xargs rm -rf);
> > -            !system( $find_cmd ) or die( "Couldn't $find_cmd" );
> > -        }
> > -        close(VG);
> > -
> >          # 
> >          # Dir in which to hold stuff.  XXX dannf where should this really 
> > go?
> >          #
> > 
> > 
> > 
> > 
> > 
> > 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting language
> that extends applications into web and mobile media. Attend the live webcast
> and join the prime developer group breaking into this new coding territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
> _______________________________________________
> Sisuite-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sisuite-users

-- 

-ashley

Did you try poking at it with a stick?



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sisuite-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sisuite-users

Reply via email to