Added --install flag.

This commit is contained in:
EinMByte 2015-09-18 14:19:06 +02:00
parent c741382fc9
commit 3ef89718a1
5 changed files with 84 additions and 9 deletions

View file

@ -56,7 +56,19 @@ namespace i2p
LogPrint("\n\n\n\ni2pd starting\n");
LogPrint("Version ", VERSION);
LogPrint("data directory: ", i2p::util::filesystem::GetDataDir().string());
i2p::util::filesystem::ReadConfigFile(i2p::util::config::mapArgs, i2p::util::config::mapMultiArgs);
i2p::util::filesystem::ReadConfigFile(
i2p::util::config::mapArgs, i2p::util::config::mapMultiArgs
);
if(i2p::util::config::HasArg("-install")) {
try {
i2p::util::filesystem::InstallFiles();
LogPrint("Succesfully installed all files.");
} catch(const std::runtime_error& e) {
LogPrint(eLogError, "Failed to install: ", e.what());
return false;
}
}
isDaemon = i2p::util::config::GetArg("-daemon", 0);
isLogging = i2p::util::config::GetArg("-log", 1);
@ -104,7 +116,6 @@ namespace i2p
else
StartLog (""); // write to stdout
}
d.httpServer = new i2p::util::HTTPServer(
i2p::util::config::GetArg("-httpaddress", "127.0.0.1"),
i2p::util::config::GetArg("-httpport", 7070)

View file

@ -107,7 +107,9 @@ void HTTPConnection::Send404Reply()
"<head><title>Error: 404 - webui not installed</title></head><body>"
"<p>It looks like your webui installation is broken.</p>"
"<p>Run the following command to (re)install it:</p>"
"<pre>./i2pd --install /path/to/webui</pre>"
"<pre>./i2pd --install=/path/to/webui</pre>"
"<p>Or from a directory containing a folder named webui:</p>"
"<pre>./i2pd --install</pre>"
"<p>The webui folder should come with the binaries.</p>"
"</body></html>"
);

View file

@ -3,13 +3,13 @@
#include "Daemon.h"
#include "Reseed.h"
int main( int argc, char* argv[] )
int main(int argc, char* argv[])
{
Daemon.init(argc, argv);
if (Daemon.start())
{
while (Daemon.running)
{
if(!Daemon.init(argc, argv))
return EXIT_FAILURE;
if(Daemon.start()) {
while (Daemon.running) {
//TODO Meeh: Find something better to do here.
std::this_thread::sleep_for (std::chrono::seconds(1));
}