Skip to content

Commit

Permalink
Merge 82a2bc4 into 8364180
Browse files Browse the repository at this point in the history
  • Loading branch information
swelljoe committed May 17, 2022
2 parents 8364180 + 82a2bc4 commit 0eed669
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 68 deletions.
4 changes: 2 additions & 2 deletions lib/Virtualmin/Config/Dummy.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ use warnings;
use 5.010;

sub new {
my ($class, %args) = @_;
my ( $class, %args ) = @_;
my $self = {};

return bless $self, $class;
}

sub plugins {
return ["Test", "Test2",];
return [ "Test", "Test2", ];
}

1;
31 changes: 15 additions & 16 deletions lib/Virtualmin/Config/LAMP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use 5.010_001;
# A list of plugins for configuring a LAMP stack

sub new {
my ($class, %args) = @_;
my ( $class, %args ) = @_;
my $self = {};

return bless $self, $class;
Expand All @@ -15,26 +15,25 @@ sub new {
sub plugins {

# Modern system with firewalld?
if (-x "/usr/bin/firewall-cmd" || -x "/bin/firewall-cmd") {
if ( -x "/usr/bin/firewall-cmd" || -x "/bin/firewall-cmd" ) {
return [
"Webmin", "Apache", "Bind",
"Dovecot", "Net", "AWStats",
"Postfix", "MySQL", "Firewalld",
"Procmail", "ProFTPd", "Quotas",
"SASL", "Shells", "Status",
"Upgrade", "Usermin", "Virtualmin",
"ClamAV", "NTP", "SpamAssassin",
"Fail2banFirewalld"
"Webmin", "Apache", "Bind",
"Dovecot", "AWStats", "Postfix",
"MySQL", "Firewalld", "Procmail",
"ProFTPd", "Quotas", "SASL",
"Shells", "Status", "Upgrade",
"Usermin", "Virtualmin", "ClamAV",
"NTP", "SpamAssassin", "Fail2banFirewalld"
];
}
else {
return [
"Webmin", "Apache", "Bind", "Dovecot",
"Net", "AWStats", "Postfix", "MySQL",
"Firewall", "Procmail", "ProFTPd", "Quotas",
"SASL", "Shells", "Status", "Upgrade",
"Usermin", "Virtualmin", "ClamAV", "NTP",
"SpamAssassin", "Fail2ban"
"Webmin", "Apache", "Bind", "Dovecot",
"AWStats", "Postfix", "MySQL", "Firewall",
"Procmail", "ProFTPd", "Quotas", "SASL",
"Shells", "Status", "Upgrade", "Usermin",
"Virtualmin", "ClamAV", "NTP", "SpamAssassin",
"Fail2ban"
];
}
}
Expand Down
31 changes: 15 additions & 16 deletions lib/Virtualmin/Config/LEMP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use 5.010_001;
# A list of plugins for configuring a LAMP stack

sub new {
my ($class, %args) = @_;
my ( $class, %args ) = @_;
my $self = {};

return bless $self, $class;
Expand All @@ -15,26 +15,25 @@ sub new {
sub plugins {

# Modern system with firewalld?
if (-x "/usr/bin/firewall-cmd" || -x "/bin/firewall-cmd") {
if ( -x "/usr/bin/firewall-cmd" || -x "/bin/firewall-cmd" ) {
return [
"Webmin", "Nginx", "Bind",
"Dovecot", "Net", "AWStats",
"Postfix", "MySQL", "Firewalld",
"Procmail", "ProFTPd", "Quotas",
"SASL", "Shells", "Status",
"Upgrade", "Usermin", "Virtualmin",
"ClamAV", "NTP", "SpamAssassin",
"Fail2banFirewalld"
"Webmin", "Nginx", "Bind",
"Dovecot", "AWStats", "Postfix",
"MySQL", "Firewalld", "Procmail",
"ProFTPd", "Quotas", "SASL",
"Shells", "Status", "Upgrade",
"Usermin", "Virtualmin", "ClamAV",
"NTP", "SpamAssassin", "Fail2banFirewalld"
];
}
else {
return [
"Webmin", "Nginx", "Bind", "Dovecot",
"Net", "AWStats", "Postfix", "MySQL",
"Firewall", "Procmail", "ProFTPd", "Quotas",
"SASL", "Shells", "Status", "Upgrade",
"Usermin", "Virtualmin", "ClamAV", "NTP",
"SpamAssassin", "Fail2ban"
"Webmin", "Nginx", "Bind", "Dovecot",
"AWStats", "Postfix", "MySQL", "Firewall",
"Procmail", "ProFTPd", "Quotas", "SASL",
"Shells", "Status", "Upgrade", "Usermin",
"Virtualmin", "ClamAV", "NTP", "SpamAssassin",
"Fail2ban"
];
}
}
Expand Down
20 changes: 10 additions & 10 deletions lib/Virtualmin/Config/MiniLAMP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use 5.010_001;
# A list of plugins for configuring a LAMP stack

sub new {
my ($class, %args) = @_;
my ( $class, %args ) = @_;
my $self = {};

return bless $self, $class;
Expand All @@ -15,20 +15,20 @@ sub new {
sub plugins {

# Modern system with firewalld?
if (-x "/usr/bin/firewall-cmd" || -x "/bin/firewall-cmd") {
if ( -x "/usr/bin/firewall-cmd" || -x "/bin/firewall-cmd" ) {
return [
"Webmin", "Apache", "Bind", "Net", "Postfix",
"MySQL", "Firewalld", "Procmail", "ProFTPd", "Quotas",
"Shells", "Status", "Upgrade", "Usermin", "Virtualmin",
"NTP", "Dovecot", "SASL",
"Webmin", "Apache", "Bind", "Postfix", "MySQL",
"Firewalld", "Procmail", "ProFTPd", "Quotas", "Shells",
"Status", "Upgrade", "Usermin", "Virtualmin", "NTP",
"Dovecot", "SASL",
];
}
else {
return [
"Webmin", "Apache", "Bind", "Net", "Postfix",
"MySQL", "Firewall", "Procmail", "ProFTPd", "Quotas",
"Shells", "Status", "Upgrade", "Usermin", "Virtualmin",
"NTP", "Dovecot", "SASL"
"Webmin", "Apache", "Bind", "Postfix", "MySQL",
"Firewall", "Procmail", "ProFTPd", "Quotas", "Shells",
"Status", "Upgrade", "Usermin", "Virtualmin", "NTP",
"Dovecot", "SASL"
];
}
}
Expand Down
20 changes: 10 additions & 10 deletions lib/Virtualmin/Config/MiniLEMP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use 5.010_001;
# A list of plugins for configuring a LAMP stack

sub new {
my ($class, %args) = @_;
my ( $class, %args ) = @_;
my $self = {};

return bless $self, $class;
Expand All @@ -15,20 +15,20 @@ sub new {
sub plugins {

# Modern system with firewalld?
if (-x "/usr/bin/firewall-cmd" || -x "/bin/firewall-cmd") {
if ( -x "/usr/bin/firewall-cmd" || -x "/bin/firewall-cmd" ) {
return [
"Webmin", "Nginx", "Bind", "Net", "Postfix",
"MySQL", "Firewalld", "Procmail", "ProFTPd", "Quotas",
"Shells", "Status", "Upgrade", "Usermin", "Virtualmin",
"NTP", "Dovecot", "SASL"
"Webmin", "Nginx", "Bind", "Postfix", "MySQL",
"Firewalld", "Procmail", "ProFTPd", "Quotas", "Shells",
"Status", "Upgrade", "Usermin", "Virtualmin", "NTP",
"Dovecot", "SASL"
];
}
else {
return [
"Webmin", "Nginx", "Bind", "Net", "Postfix",
"MySQL", "Firewall", "Procmail", "ProFTPd", "Quotas",
"Shells", "Status", "Upgrade", "Usermin", "Virtualmin",
"NTP", "Dovecot", "SASL"
"Webmin", "Nginx", "Bind", "Postfix", "MySQL",
"Firewall", "Procmail", "ProFTPd", "Quotas", "Shells",
"Status", "Upgrade", "Usermin", "Virtualmin", "NTP",
"Dovecot", "SASL"
];
}
}
Expand Down
27 changes: 14 additions & 13 deletions lib/Virtualmin/Config/Plugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ our $count = 1;
my $log = Log::Log4perl->get_logger("virtualmin-config-system");

sub new {
my ($class, %args) = @_;
my ( $class, %args ) = @_;

my $self = {
name => $args{name},
Expand All @@ -36,28 +36,28 @@ sub new {

# Plugin short name, used in config definitions
sub name {
my ($self, $name) = @_;
my ( $self, $name ) = @_;
if ($name) { $self->{name} = $name }
return $self->{name};
}

# Return a ref to an array of plugins that have to run before this one.
# Dep resolution is very stupid. Don't do anything complicated.
sub depends {
my ($self, $name) = @_;
my ( $self, $name ) = @_;
if ($name) { $self->{depends} = shift }
return $self->{depends};
}

# Total number of plugins being run for running count
sub total {
my ($self, $total) = @_;
my ( $self, $total ) = @_;
if ($total) { $self->{total} = shift }
return $self->{total};
}

sub bundle {
my ($self, $bundle) = @_;
my ( $self, $bundle ) = @_;
if ($bundle) { $self->{bundle} = shift }
return $self->{bundle};
}
Expand All @@ -68,19 +68,20 @@ sub spin {
my $message = shift // "Configuring " . $name;
$log->info($message);
$spinner = Term::Spinner::Color->new();
$message
= "["
$message = "["
. YELLOW
. $count
. RESET . "/"
. GREEN
. $self->total()
. RESET . "] "
. $message;
my $color_correction = length(YELLOW . RESET . GREEN . RESET);
my $color_correction = length( YELLOW . RESET . GREEN . RESET );
$count++;
$message = $message . " "
x (79 - length($message) - $spinner->{'last_size'} + $color_correction);
$message =
$message
. " " x
( 79 - length($message) - $spinner->{'last_size'} + $color_correction );
print $message;
$spinner->auto_start();
}
Expand All @@ -89,13 +90,13 @@ sub done {
my $self = shift;
my $res = shift;
$spinner->auto_done();
if ($res == 1) {
if ( $res == 1 ) {

# Success!
$log->info("Succeeded");
$spinner->ok();
}
elsif ($res == 2) {
elsif ( $res == 2 ) {

# Not quite OK
$log->warn("Non-fatal error");
Expand All @@ -114,7 +115,7 @@ sub root {
$ENV{'WEBMIN_CONFIG'} ||= "/etc/webmin";
$ENV{'WEBMIN_VAR'} ||= "/var/webmin";
$ENV{'MINISERV_CONFIG'} = $ENV{'WEBMIN_CONFIG'} . "/miniserv.conf";
open(my $CONF, "<", "$ENV{'WEBMIN_CONFIG'}/miniserv.conf") || die RED,
open( my $CONF, "<", "$ENV{'WEBMIN_CONFIG'}/miniserv.conf" ) || die RED,
"Failed to open miniserv.conf", RESET;
my $root;
while (<$CONF>) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Virtualmin/Config/Plugin/Postfix.pm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sub new {
my ($class, %args) = @_;

# inherit from Plugin
my $self = $class->SUPER::new(name => 'Postfix', depends => ['Net'], %args);
my $self = $class->SUPER::new(name => 'Postfix', %args);

return $self;
}
Expand Down

0 comments on commit 0eed669

Please sign in to comment.