#!/usr/bin/perl opendir(DIR, "."); @rpms=grep(/\.rpm$/, readdir(DIR)); closedir(DIR); if ($#rpms<0) { print STDERR "No RPMs found in current directory!\n"; exit 0; } open(RPM, "rpm -qa |"); while () { chomp; if (/^(.*)-[\S]+-[\S]+$/) { $installed{$1}++; } else { print STDERR "can't determine package name for $_\n"; } } close(RPM); foreach (@rpms) { if (/^kernel-/) { print STDERR "skipping kernel-related RPM $_\n"; } elsif (/^(.*)-[\S]+-[\S]+\.(noarch|i386).rpm$/) { push(@updates, $_) if ($installed{$1}); } else { print STDERR "unable to determine package name for file $_\n"; } } #exec "rpm", "-Uvh", @updates; print join("\n", @updates), "\n";