0

我正在尝试使用这个示例创建一个 CentOS kickstart 安装文件,但它需要一些 perl 库。以下是文章建议在我的 6.4 32 位 CentOS 中安装这些库的方式,但这些库是 64 位的,并且该命令不起作用。安装所需的 32 位 perl 库以便我可以运行以下 perl 脚本的最简单方法是什么?

来自链接的图书馆:

sudo rpm -Uvh \
 perl-Compress-Raw-Zlib-2.023-119.el6.x86_64.rpm \
 perl-Compress-Zlib-2.020-119.el6.x86_64.rpm \
 perl-HTML-Parser-3.64-2.el6.x86_64.rpm \
 perl-HTML-Tagset-3.20-4.el6.noarch.rpm \
 perl-IO-Compress-Base-2.020-119.el6.x86_64.rpm \
 perl-IO-Compress-Zlib-2.020-119.el6.x86_64.rpm \
 perl-libwww-perl-5.833-2.el6.noarch.rpm \
 perl-URI-1.40-2.el6.noarch.rpm \
 perl-XML-Parser-2.36-7.el6.x86_64.rpm \
 perl-XML-Simple-2.18-6.el6.noarch.rpm

我要运行的 Perl 脚本:

#!/usr/bin/perl

use XML::Simple;

my ($comps_file, $rpm_path, $arch) = @ARGV;

if (!-e $comps_file)
{
    print_usage ("Can't find '$comps_file'");
}
if (!-e $rpm_path)
{
    print_usage ("RPM path '$comps_file' does not exist");
}
if (!$arch)
{
    print_usage ("Architecture not specified");
}

print "reading $comps_file...\n";
print "getting RPMs from $rpm_path...\n";

$xml = new XML::Simple;
$comps = $xml->XMLin($comps_file);

%copied_packages = {};

foreach $group (@{$comps->{group}})
{
    $id = $group->{id};
    if (!($id eq 'base' || $id eq 'core'))
    {
        next;
    }

    print "#### group \@$id\n";
    $packagelist = $group->{packagelist};
    foreach $pr (@{$packagelist->{packagereq}})
    {
        if ($pr->{type} eq 'optional')
        {
            next;
        }

        $cmd = "cp $rpm_path/" . $pr->{content} . "-[0-9]*.$arch.rpm"
                . " $rpm_path/" . $pr->{content} . "-[0-9]*.noarch.rpm .";
        print "$cmd\n";
        `$cmd 2>&1`;

        $copied_packages{$pr->{content}} = 1;
    }
}

sub print_usage
{
    my ($msg) = @_;

    ($msg) && print "$msg\n\n";

    print <<__TEXT__;
parse_comps.pl comps_file rpm_path arch
    comps_file   the full path to the comps.xml file (as provided in the
                 original distro
    rpm_path     the full path to the directory of all RPMs from the distro
    arch         the target system architecture (e.g. x86_64)


__TEXT__

    exit;
}
4

1 回答 1

1

你总是可以尝试:

sudo yum install perl-XML-Simple

并将yum完成其余的工作。

于 2013-05-16T02:47:34.073 回答