Skip to content

Commit

Permalink
Added: 'CMD_SYSCTL and 'SYSCTL_CONF_DIR parameters for sysctl(8)
Browse files Browse the repository at this point in the history
Added: iMSCP::Provider::Service::Interface
Added: Routine to setup kernel
Fixed: Avoid usage of Scalar::Defer whenever possible
Fixed: iMSCP::Service must implements iMSCP::Provider::Service::Interface
Fixed: iMSCP::Provider::Service::Sysvinit must implements iMSCP::Provider::Service::Interface
Removed: Support for systemd older than 204-3 (iMSCP::Provider::Service::Debian::Systemd)
Removed: Support for sysv-rc older than 2.88 (iMSCP::Provider::Service::Debian::Sysvinit)
Updated license headers
  • Loading branch information
nuxwin committed May 2, 2017
1 parent 11eaa55 commit b839d83
Show file tree
Hide file tree
Showing 31 changed files with 330 additions and 195 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ Git 1.4.x

BACKEND
Fixed: Can't use an undefined value as a HASH reference; DBI::selectrow_hashref() return undef on empty results
Removed: Support for systemd older than 204-3 (iMSCP::Provider::Service::Debian::Systemd)
Removed: Support for sysv-rc older than 2.88 (iMSCP::Provider::Service::Debian::Sysvinit)

CONFIG
Added: 'CMD_SYSCTL` and 'SYSCTL_CONF_DIR` parameters for sysctl(8)

CRON
Fixed: Cron tasks for traffic accounting are never executed due to wrong command in /etc/cron.d/imscp cron file

DISTRIBUTION
Added: Support for Devuan jessie (1.0) - See https://devuan.org/
Added: Support for Devuan jessie (1.0 RC) - See https://devuan.org/

FRONTEND
Fixed: Allow auto-completion for login form (regression fix)
Expand All @@ -21,6 +26,7 @@ LISTENERS
Updated: 70_postfix_submission_tls.pl file (fully redefine submission service and disable SSLv3)

INSTALLER
Added: Routine to setup kernel
Fixed: Don't check for source archive when binary archive has not been found for a specific section (APT repositories)
Fixed: Usage of ZG-POLICY-RC.D(8) to provide local policy-rc.d and avoid violation of Debian policy (Debian/Ubuntu)

Expand Down
4 changes: 4 additions & 0 deletions configs/debian/imscp.conf
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ DEBUG = 0
# Depreciated variables (only keept for upgrade process)
CACHE_DATA_DIR = /var/cache/imscp

# SYSCTL(8)
CMD_SYSCTL = /sbin/sysctl
SYSCTL_CONF_DIR = /etc/sysctl.d

# List of selected alternatives
# Please, do not change these parameters manually
FRONTEND_SERVER =
Expand Down
2 changes: 1 addition & 1 deletion contrib/Listeners/Apache2/10_apache2_dualstack.pl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# i-MSCP Listener::Apache2::DualStack listener file
# Copyright (C) 2015-2017 Laurent Declercq <l.declercq@nuxwin.com>
# Copyright (C) 2010-2017 Laurent Declercq <l.declercq@nuxwin.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
Expand Down
2 changes: 1 addition & 1 deletion contrib/Listeners/Named/10_named_rrl.pl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# i-MSCP Listener::Named::Rrl listener file
# Copyright (C) 2015-2017 Laurent Declercq <l.declercq@nuxwin.com>
# Copyright (C) 2010-2017 Laurent Declercq <l.declercq@nuxwin.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
Expand Down
2 changes: 1 addition & 1 deletion contrib/Listeners/Named/20_named_dualstack.pl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# i-MSCP Listener::Bind9::DualStack listener file
# Copyright (C) 2017 Laurent Declercq <l.declercq@nuxwin.com>
# Copyright (C) 2010-2017 Laurent Declercq <l.declercq@nuxwin.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
Expand Down
2 changes: 1 addition & 1 deletion contrib/Listeners/Packages/10_packages_override.pl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# i-MSCP Listener::Packages::Override listener file
# Copyright (C) 2015-2017 Laurent Declercq <l.declercq@nuxwin.com>
# Copyright (C) 2010-2017 Laurent Declercq <l.declercq@nuxwin.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
Expand Down
2 changes: 1 addition & 1 deletion contrib/Listeners/Postfix/10_postfix_smarthost.pl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# i-MSCP - internet Multi Server Control Panel
# Copyright (C) 2013-2017 by Laurent Declercq
# Copyright (C) 2010-2017 by Laurent Declercq
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion contrib/Listeners/Postfix/10_postfix_tuning.pl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# i-MSCP Listener::Postfix::Tuning listener file
# Copyright (C) 2015-2017 Laurent Declercq <l.declercq@nuxwin.com>
# Copyright (C) 2010-2017 Laurent Declercq <l.declercq@nuxwin.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
Expand Down
2 changes: 1 addition & 1 deletion contrib/Listeners/System/10_system_hosts.pl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# i-MSCP Listener::System::Hosts listener file
# Copyright (C) 2015-2017 Laurent Declercq <l.declercq@nuxwin.com>
# Copyright (C) 2010-2017 Laurent Declercq <l.declercq@nuxwin.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
Expand Down
2 changes: 1 addition & 1 deletion contrib/Listeners/System/10_system_mount_userwebdir.pl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# i-MSCP Listener::System::Mount::Userwebdir listener file
# Copyright (C) 2015-2017 Laurent Declercq <l.declercq@nuxwin.com>
# Copyright (C) 2010-2017 Laurent Declercq <l.declercq@nuxwin.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
Expand Down
2 changes: 1 addition & 1 deletion contrib/scripts/imscp_mail_from_csv.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright (C) 2015-2017 by Laurent Declercq
* Copyright (C) 2010-2017 by Laurent Declercq
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion engine/PerlLib/Modules/CustomDNS.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
=cut

# i-MSCP - internet Multi Server Control Panel
# Copyright (C) 2015-2017 by Laurent Declercq <l.declercq@nuxwin.com>
# Copyright (C) 2010-2017 by Laurent Declercq <l.declercq@nuxwin.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion engine/PerlLib/Modules/FtpUser.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
=cut

# i-MSCP - internet Multi Server Control Panel
# Copyright (C) 2015-2017 by Laurent Declercq <l.declercq@nuxwin.com>
# Copyright (C) 2010-2017 by Laurent Declercq <l.declercq@nuxwin.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion engine/PerlLib/Modules/Plugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
=cut

# i-MSCP - internet Multi Server Control Panel
# Copyright (C) 2013-2017 by Laurent Declercq <l.declercq@nuxwin.com>
# Copyright (C) 2010-2017 by Laurent Declercq <l.declercq@nuxwin.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion engine/PerlLib/Servers/ftpd/vsftpd.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
=cut

# i-MSCP - internet Multi Server Control Panel
# Copyright (C) 2015-2017 by Laurent Declercq <l.declercq@nuxwin.com>
# Copyright (C) 2010-2017 by Laurent Declercq <l.declercq@nuxwin.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion engine/PerlLib/Servers/ftpd/vsftpd/installer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
=cut

# i-MSCP - internet Multi Server Control Panel
# Copyright (C) 2015-2017 by Laurent Declercq <l.declercq@nuxwin.com>
# Copyright (C) 2010-2017 by Laurent Declercq <l.declercq@nuxwin.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion engine/PerlLib/Servers/ftpd/vsftpd/uninstaller.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
=cut

# i-MSCP - internet Multi Server Control Panel
# Copyright (C) 2015-2017 by Laurent Declercq <l.declercq@nuxwin.com>
# Copyright (C) 2010-2017 by Laurent Declercq <l.declercq@nuxwin.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion engine/PerlLib/iMSCP/Provider/NetworkInterface.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
=cut

# i-MSCP - internet Multi Server Control Panel
# Copyright (C) 2015-2017 by Laurent Declercq <l.declercq@nuxwin.com>
# Copyright (C) 2010-2017 by Laurent Declercq <l.declercq@nuxwin.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion engine/PerlLib/iMSCP/Provider/NetworkInterface/Debian.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
=cut

# i-MSCP - internet Multi Server Control Panel
# Copyright (C) 2015-2017 by Laurent Declercq <l.declercq@nuxwin.com>
# Copyright (C) 2010-2017 by Laurent Declercq <l.declercq@nuxwin.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion engine/PerlLib/iMSCP/Provider/NetworkInterface/Devuan.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
=cut

# i-MSCP - internet Multi Server Control Panel
# Copyright (C) 2017 by Laurent Declercq <l.declercq@nuxwin.com>
# Copyright (C) 2010-2017 by Laurent Declercq <l.declercq@nuxwin.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
=cut

# i-MSCP - internet Multi Server Control Panel
# Copyright (C) 2015-2017 by Laurent Declercq <l.declercq@nuxwin.com>
# Copyright (C) 2010-2017 by Laurent Declercq <l.declercq@nuxwin.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion engine/PerlLib/iMSCP/Provider/NetworkInterface/Ubuntu.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
=cut

# i-MSCP - internet Multi Server Control Panel
# Copyright (C) 2015-2017 by Laurent Declercq <l.declercq@nuxwin.com>
# Copyright (C) 2010-2017 by Laurent Declercq <l.declercq@nuxwin.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down
51 changes: 4 additions & 47 deletions engine/PerlLib/iMSCP/Provider/Service/Debian/Systemd.pm
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ package iMSCP::Provider::Service::Debian::Systemd;

use strict;
use warnings;
use iMSCP::File;
use File::Basename;
use Scalar::Defer;
use parent qw/ iMSCP::Provider::Service::Systemd iMSCP::Provider::Service::Debian::Sysvinit /;

# Commands used in that package
Expand All @@ -36,14 +34,6 @@ my %COMMANDS = (
systemctl => '/bin/systemctl'
);

# Enable compatibility mode if systemd version is lower than version 204-3
my $SYSTEMCTL_COMPAT_MODE = lazy
{
__PACKAGE__->_exec(
"$COMMANDS{'dpkg'} --compare-versions \$(dpkg-query -W -f='\${Version}' systemd) lt 204-3"
) == 0;
};

=head1 DESCRIPTION
Service provider for Debian `systemd' service/socket units.
Expand Down Expand Up @@ -102,24 +92,6 @@ sub enable
$realUnit = basename( readlink( $unitFilePath ), '.service', '.socket' ) if -l $unitFilePath;
}

if ($SYSTEMCTL_COMPAT_MODE) {
if ($self->_isSystemd( $realUnit )) {
return 0 unless $self->SUPER::enable( $realUnit );
}

# Backward compatibility operations
# We must manually enable the underlying sysvinit script if any. This is needed because `systemctl' as provided
# in systemd packages older than version 204-3, doesn't make call of `the update-rc-d <service> enable'. Thus,
# the sysvinit script is not enabled. We must also make call of `systemctl daemon-reload' to make systemd aware
# of changes.
if ($self->_isSysvinit( $unit )) {
return $self->iMSCP::Provider::Service::Debian::Sysvinit::enable( $unit )
&& $self->_exec( $COMMANDS{'systemctl'}, '--system', 'daemon-reload' ) == 0
}

return 1;
}

# Note: Will automatically call update-rc.d in case of a sysvinit script
$self->SUPER::enable( $realUnit );
}
Expand All @@ -145,24 +117,6 @@ sub disable
$realUnit = basename( readlink( $unitFilePath ), '.service', '.socket' ) if -l $unitFilePath;
}

if ($SYSTEMCTL_COMPAT_MODE) {
if ($self->_isSystemd( $realUnit )) {
return 0 unless $self->SUPER::disable( $realUnit );
}

# Backward compatibility operations
# We must manually disable the underlying sysvinit script if any. This is needed because `systemctl' as provided
# in systemd packages older than version 204-3, doesn't make call of `the update-rc-d <service> disable'. Thus,
# the sysvinit script is not disabled. We must also make call of `systemctl daemon-reload' to make systemd aware
# of changes.
if ($self->_isSysvinit( $unit )) {
return $self->iMSCP::Provider::Service::Debian::Sysvinit::disable( $unit )
&& $self->_exec( $COMMANDS{'systemctl'}, '--system', 'daemon-reload' ) == 0;
}

return 1;
}

# Note: Will automatically call update-rc.d in case of a sysvinit script
$self->SUPER::disable( $realUnit );
}
Expand Down Expand Up @@ -209,7 +163,10 @@ sub hasService
my ($self, $service) = @_;

defined $service or die( 'parameter $service is not defined' );
$self->_isSystemd( $service ) || $self->iMSCP::Provider::Service::Debian::Sysvinit::hasService( $service );

return 1 if $self->SUPER::hasService( $service );
return 0 if $service =~ /\.socket$/;
$self->iMSCP::Provider::Service::Debian::Sysvinit::hasService( $service );
}

=back
Expand Down
22 changes: 0 additions & 22 deletions engine/PerlLib/iMSCP/Provider/Service/Debian/Sysvinit.pm
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ package iMSCP::Provider::Service::Debian::Sysvinit;

use strict;
use warnings;
use iMSCP::File;
use Scalar::Defer;
use parent 'iMSCP::Provider::Service::Sysvinit';

# Commands used in that package
Expand All @@ -36,14 +34,6 @@ my %COMMANDS = (
'update-rc.d' => '/usr/sbin/update-rc.d'
);

# Enable compatibility mode if sysv-rc package version is lower than version 2.88
my $SYSVRC_COMPAT_MODE = lazy
{
__PACKAGE__->_exec(
"$COMMANDS{'dpkg'} --compare-versions \$(dpkg-query -W -f '\${Version}' sysv-rc) lt 2.88"
) == 0;
};

=head1 DESCRIPTION
Service provider for Debian `sysvinit' scripts.
Expand Down Expand Up @@ -105,13 +95,8 @@ sub enable

defined $service or die( 'parameter $service is not defined' );

#if ($SYSVRC_COMPAT_MODE) {
return $self->_exec( $COMMANDS{'update-rc.d'}, '-f', $service, 'remove' ) == 0
&& $self->_exec( $COMMANDS{'update-rc.d'}, $service, 'defaults' ) == 0;
#}

#$self->_exec( $COMMANDS{'update-rc.d'}, $service, 'defaults' ) == 0
# && $self->_exec( $COMMANDS{'update-rc.d'}, $service, 'enable' ) == 0;
}

=item disable( $service )
Expand All @@ -129,13 +114,6 @@ sub disable

defined $service or die( 'parameter $service is not defined' );

if ($SYSVRC_COMPAT_MODE) {
return $self->_exec( $COMMANDS{'update-rc.d'}, '-f', $service, 'remove' ) == 0
&& $self->_exec( $COMMANDS{'update-rc.d'}, $service, 'stop', '00', '1', '2', '3', '4', '5', '6', '.' ) == 0;
}

#$self->_exec( $COMMANDS{'update-rc.d'}, $service, 'defaults' ) == 0
#&& $self->_exec( $COMMANDS{'update-rc.d'}, $service, 'disable' ) == 0;
$self->_exec( $COMMANDS{'update-rc.d'}, $service, 'disable' ) == 0;
}

Expand Down
5 changes: 3 additions & 2 deletions engine/PerlLib/iMSCP/Provider/Service/Debian/Upstart.pm
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,9 @@ sub hasService
{
my ($self, $service) = @_;

defined $service or die( 'parameter service is not defined' );
$self->_isUpstart( $service ) || self->iMSCP::Provider::Service::Debian::hasService( $service );
defined $service or die( 'parameter $service is not defined' );

$self->SUPER::hasService( $service ) || $self->iMSCP::Provider::Service::Debian::hasService( $service );
}

=back
Expand Down

0 comments on commit b839d83

Please sign in to comment.