mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 14:13:29 +00:00
Add button to refresh ports DB
This commit is contained in:
@@ -523,8 +523,13 @@ elsif ($software::update_system eq "apt") {
|
||||
&execute_command("apt-get update");
|
||||
}
|
||||
elsif ($software::update_system eq "ports") {
|
||||
&execute_command("portsnap fetch");
|
||||
&execute_command("portsnap update || portsnap extract");
|
||||
&foreign_require("proc");
|
||||
foreach my $cmd ("portsnap fetch",
|
||||
"portsnap update || portsnap extract") {
|
||||
my ($fh, $pid) = &proc::pty_process_exec($cmd);
|
||||
while(<$fh>) { }
|
||||
close($fh);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -399,5 +399,9 @@ ports_ok=.. install complete
|
||||
ports_input=Package from ports
|
||||
ports_find=Search Ports
|
||||
ports_name=FreeBSD ports
|
||||
ports_form=Update Ports Database
|
||||
ports_apply=Download Latest Snapshot
|
||||
ports_upgrade=Downloading Ports Snapshot
|
||||
ports_running=Running command $1 ..
|
||||
|
||||
__norefs=1
|
||||
|
||||
@@ -141,4 +141,13 @@ while(my $line = <PKG>) {
|
||||
return @rv;
|
||||
}
|
||||
|
||||
# update_system_form()
|
||||
# Show a form for updating the ports DB
|
||||
sub update_system_form
|
||||
{
|
||||
print &ui_subheading($text{'ports_form'});
|
||||
print &ui_form_start("ports_upgrade.cgi");
|
||||
print &ui_form_end([ [ undef, $text{'ports_apply'} ] ]);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
23
software/ports_upgrade.cgi
Normal file
23
software/ports_upgrade.cgi
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/usr/local/bin/perl
|
||||
# Update ports snapshot
|
||||
|
||||
require './software-lib.pl';
|
||||
&foreign_require("proc");
|
||||
|
||||
&ui_print_unbuffered_header(undef, $text{'ports_upgrade'}, "");
|
||||
|
||||
foreach my $cmd ("portsnap fetch",
|
||||
"portsnap update || portsnap extract") {
|
||||
print &text('ports_running', "<tt>$cmd</tt>"),"<br>\n";
|
||||
print "<pre>";
|
||||
($fh, $pid) = &proc::pty_process_exec($cmd);
|
||||
while(<$fh>) {
|
||||
print &html_escape($_);
|
||||
}
|
||||
close($fh);
|
||||
print "</pre>";
|
||||
last if ($?);
|
||||
}
|
||||
|
||||
&ui_print_footer("", $text{'index_return'});
|
||||
|
||||
Reference in New Issue
Block a user