doubledecker has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks
I'm working on linux and writing a perl script which checks for some packages on it. If packages are not found, i need to install them. here is what i've tried so far...
#!/usr/bin/perl use strict; open( RPM, "rpm -qa |"); my @rpms = <RPM>; chomp(@rpms); close RPM; # Remove the duplicate values @rpms = keys %{{ map { $_ => 1 } @rpms }}; my @glibc_rpm = grep(/glibc/, @rpms); if ( @glibc_rpm ) { print "package found"; } else { # Install the package my $retCode = qx'yum install glibc-common-2.5-49'; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: yum in perl
by moritz (Cardinal) on Mar 02, 2012 at 08:55 UTC | |
by doubledecker (Scribe) on Mar 02, 2012 at 09:09 UTC | |
|
Re: yum in perl
by JavaFan (Canon) on Mar 02, 2012 at 09:57 UTC | |
|
Re: yum in perl
by CountZero (Bishop) on Mar 02, 2012 at 14:45 UTC | |
by JavaFan (Canon) on Mar 02, 2012 at 15:22 UTC | |
|
Re: yum in perl
by Khen1950fx (Canon) on Mar 03, 2012 at 11:58 UTC |