Added new option to generate config file.

fix #130
This commit is contained in:
Antoine Nguyen
2017-06-23 09:43:41 +02:00
parent 85aa37d7d5
commit 8052f4aede
4 changed files with 16 additions and 2 deletions

View File

@@ -27,7 +27,9 @@ Usage::
$ cd modoboa-installer
$ sudo ./run.py <your domain>
To customize the installation, look at the ``installer.cfg`` file.
A configuration file will be automatically generated the first time
you run the installer, please don't copy the
``installer.cfg.template`` file manually.
By default, the following components are installed:
@@ -37,6 +39,13 @@ By default, the following components are installed:
* Dovecot
* Amavis (with SpamAssassin and ClamAV)
If you want to customize configuration before running the installer,
run the following command::
$ ./run.py --stop-after-configfile-check <your domain>
Make your modifications and run the installer as usual.
If you want more information about the installation process, add the
``--debug`` option to your command line.

View File

@@ -146,7 +146,7 @@ def check_config_file(dest):
printcolor(
"Configuration file {} not found, creating new one."
.format(dest), YELLOW)
with open("installer.cfg.default") as fp:
with open("installer.cfg.template") as fp:
buf = fp.read()
context = {
"mysql_password": make_password(),

5
run.py
View File

@@ -23,6 +23,9 @@ def main():
help="Force installation")
parser.add_argument("--configfile", default="installer.cfg",
help="Configuration file to use")
parser.add_argument(
"--stop-after-configfile-check", action="store_true", default=False,
help="Check configuration, generate it if needed and exit")
parser.add_argument("domain", type=str,
help="The main domain of your future mail server")
args = parser.parse_args()
@@ -31,6 +34,8 @@ def main():
utils.ENV["debug"] = True
utils.printcolor("Welcome to Modoboa installer!", utils.GREEN)
utils.check_config_file(args.configfile)
if args.stop_after_configfile_check:
return
config = configparser.SafeConfigParser()
with open(args.configfile) as fp:
config.readfp(fp)