2 # Functions for installing packages with Mandrake urpmi
4 sub list_update_system_commands
9 # update_system_install([package])
10 # Install some package with urpmi
11 sub update_system_install
13 local $update = $_[0] || $in{'update'};
14 local (@rv, @newpacks);
15 local $cmd = "urpmi --force --auto --media main";
16 print "<b>",&text('urpmi_install', "<tt>$cmd $update</tt>"),"</b><p>\n";
18 &additional_log('exec', undef, "$cmd $update");
19 local $qm = join(" ", map { quotemeta($_) } split(/\s+/, $update));
20 &open_execute_command(CMD, "$cmd $qm </dev/null", 2);
23 if (/installing\s+(\S+)\s+from/) {
26 $pkg =~ s/\-\d.*//; # remove version
29 print &html_escape($_."\n");
34 print "<b>$text{'urpmi_failed'}</b><p>\n";
38 print "<b>$text{'urpmi_ok'}</b><p>\n";
43 # update_system_form()
44 # Shows a form for updating all packages on the system
45 sub update_system_form
47 print &ui_subheading($text{'urpmi_form'});
48 print &ui_form_start("urpmi_upgrade.cgi");
49 print &ui_submit($text{'urpmi_update'}, "update"),"<br>\n";
50 print &ui_submit($text{'urpmi_upgrade'}, "upgrade"),"<br>\n";
54 # update_system_resolve(name)
55 # Converts a standard package name like apache, sendmail or squid into
56 # the name used by YUM.
57 sub update_system_resolve
60 return $name eq "apache" ? "apache2" :
61 $name eq "dhcpd" ? "dhcp-server" :
62 $name eq "mysql" ? "MySQL MySQL-client MySQL-common" :
63 $name eq "postgresql" ? "postgresql postgresql-server" :
67 # update_system_available()
68 # Returns a list of package names and versions that are available from URPMI
69 sub update_system_available
73 &open_execute_command(PKG, "urpmq -f --list", 1, 1);
75 if (/^(\S+)\-(\d[^\-]*)\-([^\.]+)\.(\S+)/) {
76 next if ($done{$1,$2}++);
77 push(@rv, { 'name' => $1,