Voici le script d'Eric pour ajouter les RPM actualisés dans les répertoires de la distribution RedHat:
#!/usr/bin/perl
#
$redhatdir="/cdrom/i386";
$rpmdir="/cdrom/i386/RedHat/RPMS/";
$updatedir="/cdrom/updates/";
@OTHERDIR=($updatedir);
foreach $dir (@OTHERDIR)
{
print "update for $dir\n";
system(" find $dir -name \"*.rpm\" -exec cp {} $rpmdir \\; ");
}
chdir($contribdir) || die "peux pas aller dans $contribdir $!\n";
system("chmod -R 755 $redhatdir");
chdir($rpmdir) || die "problem to go in $rpmdir $!\n";
#
# remove the old file
#
opendir(DIR,'.');
@package=grep(/\.rpm$/,readdir(DIR));
foreach $file (@package)
{
$file =~ /(.*)\-([\d+|\.]+\w*)\-(\d+)\.[i386|noarch].*/;
$nom=$1;
$version=$2;
$buildvers=$3;
if ($NOM{$nom})
{
$version2=$VERSION{$nom};
$buildver2=$BUILDVERS{$nom};
$file2=$FILE{$nom};
$nom2=$NOM{$nom};
if ( $version2 gt $version )
{
print "$file2 is newer than $file\n";
unlink($file);
}
else
{
if ( $version2 lt $version )
{
print "$file is newer than $file2\n";
unlink($file2);
$VERSION{$nom}=$version;
$BUILDVERS{$nom}=$buildvers;
$FILE{$nom}=$file;
$NOM{$nom}=$nom;
}
else
{
# print "$file2 $file same version version\n";
if ( $buildver2> $buildvers )
{
print "$file2 : $buildver2 est mieux que $file : $buildvers\n";
unlink($file);
}
else
{
print "$file2 : $buildver2 is older than $file : $buildvers\n";
unlink($file2);
$VERSION{$nom}=$version;
$BUILDVERS{$nom}=$buildvers;
$FILE{$nom}=$file;
$NOM{$nom}=$nom;
}
}
}
}
else
{
$VERSION{$nom}=$version;
$BUILDVERS{$nom}=$buildvers;
$FILE{$nom}=$file;
$NOM{$nom}=$nom;
}
}
# we do the hard thing here
#
system("$redhatdir/misc/src/install/genhdlist $redhatdir");
Hosting by: Hurra Communications GmbH
Generated: 2007-01-26 18:01:28