From 8437d458661f8c439719a024ea457699161ec70e Mon Sep 17 00:00:00 2001 From: hagen Date: Mon, 28 Mar 2016 00:00:00 +0000 Subject: [PATCH] * rename i2p.conf -> i2pd.conf, add detection of old config --- Config.cpp | 2 +- Daemon.cpp | 14 +++++++++++--- debian/i2pd.1 | 2 +- debian/i2pd.links | 2 +- docs/configuration.md | 4 ++-- docs/{i2p.conf => i2pd.conf} | 0 6 files changed, 16 insertions(+), 8 deletions(-) rename docs/{i2p.conf => i2pd.conf} (100%) diff --git a/Config.cpp b/Config.cpp index 8671f38c..f9cf2477 100644 --- a/Config.cpp +++ b/Config.cpp @@ -107,7 +107,7 @@ namespace config { options_description general("General options"); general.add_options() ("help", "Show this message") - ("conf", value()->default_value(""), "Path to main i2pd config file (default: try ~/.i2pd/i2p.conf or /var/lib/i2pd/i2p.conf)") + ("conf", value()->default_value(""), "Path to main i2pd config file (default: try ~/.i2pd/i2pd.conf or /var/lib/i2pd/i2pd.conf)") ("tunconf", value()->default_value(""), "Path to config with tunnels list and options (default: try ~/.i2pd/tunnels.cfg or /var/lib/i2pd/tunnels.cfg)") ("pidfile", value()->default_value(""), "Path to pidfile (default: ~/i2pd/i2pd.pid or /var/lib/i2pd/i2pd.pid)") ("log", value()->default_value(""), "Logs destination: stdout, file, syslog (stdout if not set)") diff --git a/Daemon.cpp b/Daemon.cpp index 29d52ecc..d4803195 100644 --- a/Daemon.cpp +++ b/Daemon.cpp @@ -69,11 +69,19 @@ namespace i2p i2p::fs::Init(); datadir = i2p::fs::GetDataDir(); - if (config == "") + // TODO: drop old name detection in v2.8.0 + if (config == "") { config = i2p::fs::DataDirPath("i2p.conf"); - // use i2p.conf only if exists - if (!i2p::fs::Exists (config)) config = ""; /* reset */ + if (i2p::fs::Exists (config)) { + LogPrint(eLogWarning, "Daemon: please rename i2p.conf to i2pd.conf here: ", config); + } else { + config = i2p::fs::DataDirPath("i2pd.conf"); + if (!i2p::fs::Exists (config)) { + // use i2pd.conf only if exists + config = ""; /* reset */ + } + } } i2p::config::ParseConfig(config); diff --git a/debian/i2pd.1 b/debian/i2pd.1 index c6f0e9ba..2a1e7f88 100644 --- a/debian/i2pd.1 +++ b/debian/i2pd.1 @@ -68,7 +68,7 @@ Port of BOB command channel. Usually \fI2827\fR. BOB will not be enabled if this Port of I2P control service. Usually \fI7650\fR. I2PControl will not be enabled if this is not set. (default: unset) .TP \fB\-\-conf=\fR -Config file (default: \fI~/.i2pd/i2p.conf\fR or \fI/var/lib/i2pd/i2p.conf\fR) +Config file (default: \fI~/.i2pd/i2pd.conf\fR or \fI/var/lib/i2pd/i2pd.conf\fR) This parameter will be silently ignored if the specified config file does not exist. Options specified on the command line take precedence over those in the config file. diff --git a/debian/i2pd.links b/debian/i2pd.links index 369cce5b..58a75552 100644 --- a/debian/i2pd.links +++ b/debian/i2pd.links @@ -1,4 +1,4 @@ -etc/i2pd/i2pd.conf var/lib/i2pd/i2p.conf +etc/i2pd/i2pd.conf var/lib/i2pd/i2pd.conf etc/i2pd/tunnels.conf var/lib/i2pd/tunnels.cfg etc/i2pd/subscriptions.txt var/lib/i2pd/subscriptions.txt usr/share/i2pd/certificates var/lib/i2pd/certificates diff --git a/docs/configuration.md b/docs/configuration.md index 46e5092c..3d03b1c7 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -4,7 +4,7 @@ i2pd configuration Command line options -------------------- -* --conf= - Config file (default: ~/.i2pd/i2p.conf or /var/lib/i2pd/i2p.conf) +* --conf= - Config file (default: ~/.i2pd/i2pd.conf or /var/lib/i2pd/i2pd.conf) This parameter will be silently ignored if the specified config file does not exist. Options specified on the command line take precedence over those in the config file. * --tunconf= - Tunnels config file (default: ~/.i2pd/tunnels.cfg or /var/lib/i2pd/tunnels.cfg) @@ -60,7 +60,7 @@ All command-line parameters are allowed as keys, but note for those which contai For example: -i2p.conf: +i2pd.conf: # comment log = true diff --git a/docs/i2p.conf b/docs/i2pd.conf similarity index 100% rename from docs/i2p.conf rename to docs/i2pd.conf