# rhn-lib.pl # Functions for installing packages from the redhat network $up2date_config = "/etc/sysconfig/rhn/up2date"; $rhn_sysconfig = "/etc/sysconfig/rhn/rhnsd"; # update_system_install([package]) # Install some package with up2date sub update_system_install { local $update = $_[0] || $in{'update'}; local @rv; print "",&text('rhn_install', "up2date $update"),"
\n"; print "
";
&additional_log('exec', undef, "up2date \"$update\"");
local $qm = quotemeta($update);
&open_execute_command(CMD, "up2date $qm 2>&1", 1);
local $got_error = 0;
while() {
while(s/^[^\015]+\015([^\012])/$1/) { }
$got_error++ if (/error|failed/i);
if (/installing.*\/([^\/\s]+)\-([^\-]+)\-([^\-]+)\.rpm/i) {
push(@rv, $1);
}
print;
}
close(CMD);
print " \n";
if ($got_error) {
print "$text{'rhn_failed'}\n"; @rv = ( ); } else { print "$text{'rhn_ok'}
\n"; } return @rv; } # update_system_form() # Show a form for configuring the redhat update agent sub update_system_form { print &ui_subheading($text{'rhn_form'}); print "
\n"; } # read_up2date_config() sub read_up2date_config { local %conf; local $lnum = 0; &open_readfile(CONF, $up2date_config); while(