Fixed issue with Debian bullseye (11).
This commit is contained in:
@@ -9,7 +9,7 @@ An installer which deploy a complete mail server based on Modoboa.
|
|||||||
|
|
||||||
This tool is still in beta stage, it has been tested on:
|
This tool is still in beta stage, it has been tested on:
|
||||||
|
|
||||||
* Debian Jessie (8) / Stretch (9) / Buster (10)
|
* Debian Jessie (8) / Stretch (9) / Buster (10) / Bullseye (11)
|
||||||
* Ubuntu Trusty (14.04) and upper
|
* Ubuntu Trusty (14.04) and upper
|
||||||
* CentOS 7
|
* CentOS 7
|
||||||
|
|
||||||
@@ -69,6 +69,10 @@ a previous one using the ``--version`` option::
|
|||||||
|
|
||||||
Version selection is available only for Modoboa >= 1.8.1.
|
Version selection is available only for Modoboa >= 1.8.1.
|
||||||
|
|
||||||
|
You can also install beta releases using the ``--beta`` flag::
|
||||||
|
|
||||||
|
$ sudo ./run.py --beta <your domain>
|
||||||
|
|
||||||
If you want more information about the installation process, add the
|
If you want more information about the installation process, add the
|
||||||
``--debug`` option to your command line.
|
``--debug`` option to your command line.
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class PostgreSQL(Database):
|
|||||||
|
|
||||||
def install_package(self):
|
def install_package(self):
|
||||||
"""Install database if required."""
|
"""Install database if required."""
|
||||||
name, version, _id = utils.dist_info()
|
name, version = utils.dist_info()
|
||||||
if "CentOS" in name:
|
if "CentOS" in name:
|
||||||
if version.startswith("7"):
|
if version.startswith("7"):
|
||||||
# Install newer version of postgres in this case
|
# Install newer version of postgres in this case
|
||||||
@@ -158,22 +158,35 @@ class MySQL(Database):
|
|||||||
|
|
||||||
def install_package(self):
|
def install_package(self):
|
||||||
"""Preseed package installation."""
|
"""Preseed package installation."""
|
||||||
name, version, _id = utils.dist_info()
|
name, version = utils.dist_info()
|
||||||
name = name.lower()
|
name = name.lower()
|
||||||
if name == "debian":
|
if name.startswith("debian"):
|
||||||
mysql_name = "mysql" if version.startswith("8") else "mariadb"
|
if version.startswith("8"):
|
||||||
self.packages["deb"].append("lib{}client-dev".format(mysql_name))
|
self.packages["deb"].append("libmysqlclient-dev")
|
||||||
|
elif version.startswith("11"):
|
||||||
|
self.packages["deb"].append("libmariadb-dev")
|
||||||
|
else:
|
||||||
|
self.packages["deb"].append("libmariadbclient-dev")
|
||||||
elif name == "ubuntu":
|
elif name == "ubuntu":
|
||||||
self.packages["deb"].append("libmysqlclient-dev")
|
self.packages["deb"].append("libmysqlclient-dev")
|
||||||
super(MySQL, self).install_package()
|
super(MySQL, self).install_package()
|
||||||
if name == "debian" and version.startswith("8"):
|
queries = []
|
||||||
|
if name.startswith("debian"):
|
||||||
|
if version.startswith("8"):
|
||||||
package.backend.preconfigure(
|
package.backend.preconfigure(
|
||||||
"mariadb-server", "root_password", "password",
|
"mariadb-server", "root_password", "password",
|
||||||
self.dbpassword)
|
self.dbpassword)
|
||||||
package.backend.preconfigure(
|
package.backend.preconfigure(
|
||||||
"mariadb-server", "root_password_again", "password",
|
"mariadb-server", "root_password_again", "password",
|
||||||
self.dbpassword)
|
self.dbpassword)
|
||||||
else:
|
return
|
||||||
|
if version.startswith("11"):
|
||||||
|
queries = [
|
||||||
|
"SET PASSWORD FOR 'root'@'localhost' = PASSWORD('{}')"
|
||||||
|
.format(self.dbpassword),
|
||||||
|
"flush privileges"
|
||||||
|
]
|
||||||
|
if not queries:
|
||||||
queries = [
|
queries = [
|
||||||
"UPDATE user SET plugin='' WHERE user='root'",
|
"UPDATE user SET plugin='' WHERE user='root'",
|
||||||
"UPDATE user SET password=PASSWORD('{}') WHERE USER='root'"
|
"UPDATE user SET password=PASSWORD('{}') WHERE USER='root'"
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ def get_backend():
|
|||||||
"""Return the appropriate package backend."""
|
"""Return the appropriate package backend."""
|
||||||
distname = utils.dist_name()
|
distname = utils.dist_name()
|
||||||
backend = None
|
backend = None
|
||||||
if distname in ["debian", "ubuntu"]:
|
if distname in ["debian", "debian gnu/linux", "ubuntu"]:
|
||||||
backend = DEBPackage
|
backend = DEBPackage
|
||||||
elif "centos" in distname:
|
elif "centos" in distname:
|
||||||
backend = RPMPackage
|
backend = RPMPackage
|
||||||
|
|||||||
@@ -24,10 +24,11 @@ def get_pip_path(venv):
|
|||||||
|
|
||||||
def install_package(name, venv=None, upgrade=False, binary=True, **kwargs):
|
def install_package(name, venv=None, upgrade=False, binary=True, **kwargs):
|
||||||
"""Install a Python package using pip."""
|
"""Install a Python package using pip."""
|
||||||
cmd = "{} install{}{} {}".format(
|
cmd = "{} install{}{}{} {}".format(
|
||||||
get_pip_path(venv),
|
get_pip_path(venv),
|
||||||
" -U" if upgrade else "",
|
" -U" if upgrade else "",
|
||||||
" --no-binary :all:" if not binary else "",
|
" --no-binary :all:" if not binary else "",
|
||||||
|
" --pre" if kwargs.pop("beta", False) else "",
|
||||||
name
|
name
|
||||||
)
|
)
|
||||||
utils.exec_cmd(cmd, **kwargs)
|
utils.exec_cmd(cmd, **kwargs)
|
||||||
@@ -35,8 +36,12 @@ def install_package(name, venv=None, upgrade=False, binary=True, **kwargs):
|
|||||||
|
|
||||||
def install_packages(names, venv=None, upgrade=False, **kwargs):
|
def install_packages(names, venv=None, upgrade=False, **kwargs):
|
||||||
"""Install a Python package using pip."""
|
"""Install a Python package using pip."""
|
||||||
cmd = "{} install {}{}".format(
|
cmd = "{} install{}{} {}".format(
|
||||||
get_pip_path(venv), " -U " if upgrade else "", " ".join(names))
|
get_pip_path(venv),
|
||||||
|
" -U " if upgrade else "",
|
||||||
|
" --pre" if kwargs.pop("beta", False) else "",
|
||||||
|
" ".join(names)
|
||||||
|
)
|
||||||
utils.exec_cmd(cmd, **kwargs)
|
utils.exec_cmd(cmd, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,17 @@ server {
|
|||||||
try_files $uri $uri/ =404;
|
try_files $uri $uri/ =404;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location ^~ /new-admin {
|
||||||
|
alias %{app_instance_path}/frontend/;
|
||||||
|
index index.html;
|
||||||
|
|
||||||
|
expires -1;
|
||||||
|
add_header Pragma "no-cache";
|
||||||
|
add_header Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0";
|
||||||
|
|
||||||
|
try_files $uri $uri/ /index.html = 404;
|
||||||
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
include uwsgi_params;
|
include uwsgi_params;
|
||||||
uwsgi_param UWSGI_SCRIPT instance.wsgi:application;
|
uwsgi_param UWSGI_SCRIPT instance.wsgi:application;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class Modoboa(base.Installer):
|
|||||||
"deb": [
|
"deb": [
|
||||||
"build-essential", "python3-dev", "libxml2-dev", "libxslt-dev",
|
"build-essential", "python3-dev", "libxml2-dev", "libxslt-dev",
|
||||||
"libjpeg-dev", "librrd-dev", "rrdtool", "libffi-dev", "cron",
|
"libjpeg-dev", "librrd-dev", "rrdtool", "libffi-dev", "cron",
|
||||||
"libssl-dev", "redis-server", "supervisor"
|
"libssl-dev", "redis-server", "supervisor", "rustc"
|
||||||
],
|
],
|
||||||
"rpm": [
|
"rpm": [
|
||||||
"gcc", "gcc-c++", "python3-devel", "libxml2-devel", "libxslt-devel",
|
"gcc", "gcc-c++", "python3-devel", "libxml2-devel", "libxslt-devel",
|
||||||
@@ -75,11 +75,10 @@ class Modoboa(base.Installer):
|
|||||||
packages = ["rrdtool"]
|
packages = ["rrdtool"]
|
||||||
version = self.config.get("modoboa", "version")
|
version = self.config.get("modoboa", "version")
|
||||||
if version == "latest":
|
if version == "latest":
|
||||||
modoboa_package = "modoboa"
|
packages += ["modoboa"] + self.extensions
|
||||||
packages += self.extensions
|
|
||||||
else:
|
else:
|
||||||
matrix = compatibility_matrix.COMPATIBILITY_MATRIX[version]
|
matrix = compatibility_matrix.COMPATIBILITY_MATRIX[version]
|
||||||
modoboa_package = "modoboa=={}".format(version)
|
packages.append("modoboa=={}".format(version))
|
||||||
for extension in list(self.extensions):
|
for extension in list(self.extensions):
|
||||||
if not self.is_extension_ok_for_version(extension, version):
|
if not self.is_extension_ok_for_version(extension, version):
|
||||||
self.extensions.remove(extension)
|
self.extensions.remove(extension)
|
||||||
@@ -91,12 +90,13 @@ class Modoboa(base.Installer):
|
|||||||
packages.append("{}{}".format(extension, req_version))
|
packages.append("{}{}".format(extension, req_version))
|
||||||
else:
|
else:
|
||||||
packages.append(extension)
|
packages.append(extension)
|
||||||
# Temp fix for https://github.com/modoboa/modoboa-installer/issues/197
|
# Temp fix for django-braces
|
||||||
python.install_package(
|
python.install_package(
|
||||||
modoboa_package, self.venv_path,
|
"django-braces", self.venv_path, upgrade=self.upgrade,
|
||||||
upgrade=self.upgrade, binary=False, sudo_user=self.user)
|
sudo_user=self.user
|
||||||
|
)
|
||||||
if self.dbengine == "postgres":
|
if self.dbengine == "postgres":
|
||||||
packages.append("psycopg2-binary")
|
packages.append("psycopg2-binary\<2.9")
|
||||||
else:
|
else:
|
||||||
packages.append("mysqlclient")
|
packages.append("mysqlclient")
|
||||||
if sys.version_info.major == 2 and sys.version_info.micro < 9:
|
if sys.version_info.major == 2 and sys.version_info.micro < 9:
|
||||||
@@ -105,8 +105,10 @@ class Modoboa(base.Installer):
|
|||||||
# Temp fix for https://github.com/modoboa/modoboa/issues/2247
|
# Temp fix for https://github.com/modoboa/modoboa/issues/2247
|
||||||
packages.append("django-webpack-loader==0.7.0")
|
packages.append("django-webpack-loader==0.7.0")
|
||||||
python.install_packages(
|
python.install_packages(
|
||||||
packages, self.venv_path, upgrade=self.upgrade,
|
packages, self.venv_path,
|
||||||
sudo_user=self.user
|
upgrade=self.upgrade,
|
||||||
|
sudo_user=self.user,
|
||||||
|
beta=self.config.getboolean("modoboa", "install_beta")
|
||||||
)
|
)
|
||||||
if self.devmode:
|
if self.devmode:
|
||||||
# FIXME: use dev-requirements instead
|
# FIXME: use dev-requirements instead
|
||||||
|
|||||||
@@ -75,14 +75,19 @@ def exec_cmd(cmd, sudo_user=None, pinput=None, login=True, **kwargs):
|
|||||||
|
|
||||||
def dist_info():
|
def dist_info():
|
||||||
"""Try to return information about the system we're running on."""
|
"""Try to return information about the system we're running on."""
|
||||||
try:
|
path = "/etc/os-release"
|
||||||
# Python 3.8 and up way
|
if os.path.exists(path):
|
||||||
import distro
|
info = {}
|
||||||
return distro.linux_distribution()
|
with open(path) as fp:
|
||||||
except ImportError:
|
while True:
|
||||||
# Python 3.7 and down way
|
l = fp.readline()
|
||||||
import platform
|
if not l:
|
||||||
return platform.linux_distribution()
|
break
|
||||||
|
key, value = l.split("=")
|
||||||
|
value = value.rstrip('"\n')
|
||||||
|
value = value.strip('"')
|
||||||
|
info[key] = value
|
||||||
|
return info["NAME"], info["VERSION_ID"]
|
||||||
printcolor(
|
printcolor(
|
||||||
"Failed to retrieve information about your system, aborting.",
|
"Failed to retrieve information about your system, aborting.",
|
||||||
RED)
|
RED)
|
||||||
@@ -91,8 +96,7 @@ def dist_info():
|
|||||||
|
|
||||||
def dist_name():
|
def dist_name():
|
||||||
"""Try to guess the distribution name."""
|
"""Try to guess the distribution name."""
|
||||||
name, version, _id = dist_info()
|
return dist_info()[0].lower()
|
||||||
return name.lower()
|
|
||||||
|
|
||||||
|
|
||||||
def mkdir(path, mode, uid, gid):
|
def mkdir(path, mode, uid, gid):
|
||||||
|
|||||||
4
run.py
4
run.py
@@ -69,6 +69,9 @@ def main(input_args):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--upgrade", action="store_true", default=False,
|
"--upgrade", action="store_true", default=False,
|
||||||
help="Run the installer in upgrade mode")
|
help="Run the installer in upgrade mode")
|
||||||
|
parser.add_argument(
|
||||||
|
"--beta", action="store_true", default=False,
|
||||||
|
help="Install latest beta release of Modoboa instead of the stable one")
|
||||||
parser.add_argument("domain", type=str,
|
parser.add_argument("domain", type=str,
|
||||||
help="The main domain of your future mail server")
|
help="The main domain of your future mail server")
|
||||||
args = parser.parse_args(input_args)
|
args = parser.parse_args(input_args)
|
||||||
@@ -87,6 +90,7 @@ def main(input_args):
|
|||||||
config.set("general", "domain", args.domain)
|
config.set("general", "domain", args.domain)
|
||||||
config.set("dovecot", "domain", args.domain)
|
config.set("dovecot", "domain", args.domain)
|
||||||
config.set("modoboa", "version", args.version)
|
config.set("modoboa", "version", args.version)
|
||||||
|
config.set("modoboa", "install_beta", str(args.beta))
|
||||||
# Display disclaimerpython 3 linux distribution
|
# Display disclaimerpython 3 linux distribution
|
||||||
if not args.upgrade:
|
if not args.upgrade:
|
||||||
installation_disclaimer(args, config)
|
installation_disclaimer(args, config)
|
||||||
|
|||||||
Reference in New Issue
Block a user