Merge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim

soprefactor
Diva Canto 2010-05-15 20:28:14 -07:00
commit ff4f50396a
1 changed files with 115 additions and 1 deletions

View File

@ -105,7 +105,7 @@ namespace OpenSim
// Check if the system is compatible with OpenSimulator.
// Ensures that the minimum system requirements are met
m_log.Info("Performing compatibility checks... ");
m_log.Info("Performing compatibility checks... \n");
string supported = String.Empty;
if (Util.IsEnvironmentSupported(ref supported))
{
@ -120,6 +120,112 @@ namespace OpenSim
Culture.SetCurrentCulture();
// Validate that the user has the most basic configuration done
// If not, offer to do the most basic configuration for them warning them along the way of the importance of
// reading these files.
m_log.Info("Checking for reguired configuration...\n");
bool OpenSim_Ini = (File.Exists(Path.Combine(Util.configDir(), "OpenSim.ini")))
|| (File.Exists(Path.Combine(Util.configDir(), "opensim.ini")))
|| (File.Exists(Path.Combine(Util.configDir(), "openSim.ini")))
|| (File.Exists(Path.Combine(Util.configDir(), "Opensim.ini")));
bool StanaloneCommon_ProperCased = File.Exists(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "StandaloneCommon.ini"));
bool StanaloneCommon_lowercased = File.Exists(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "standalonecommon.ini"));
bool GridCommon_ProperCased = File.Exists(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "GridCommon.ini"));
bool GridCommon_lowerCased = File.Exists(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "gridcommon.ini"));
if ((OpenSim_Ini)
&& (
(StanaloneCommon_ProperCased
|| StanaloneCommon_lowercased
|| GridCommon_ProperCased
|| GridCommon_lowerCased
)))
{
m_log.Info("Required Configuration Files Found\n");
}
else
{
MainConsole.Instance = new LocalConsole("Region");
string resp = MainConsole.Instance.CmdPrompt(
"\n\n*************Required Configuration files not found.*************\n\n OpenSimulator will not run without these files.\n\nRemember, these file names are Case Sensitive in Linux and Proper Cased.\n1. ./OpenSim.ini\nand\n2. ./config-include/StandaloneCommon.ini \nor\n3. ./config-include/GridCommon.ini\n\nAlso, you will want to examine these files in great detail because only the basic system will load by default. OpenSimulator can do a LOT more if you spend a little time going through these files.\n\n" + ": " + "Do you want to copy the most basic Defaults from standalone?",
"yes");
if (resp == "yes")
{
if (!(OpenSim_Ini))
{
try
{
File.Copy(Path.Combine(Util.configDir(), "OpenSim.ini.example"),
Path.Combine(Util.configDir(), "OpenSim.ini"));
} catch (UnauthorizedAccessException)
{
MainConsole.Instance.Output("Unable to Copy OpenSim.ini.example to OpenSim.ini, Make sure OpenSim has have the required permissions\n");
} catch (ArgumentException)
{
MainConsole.Instance.Output("Unable to Copy OpenSim.ini.example to OpenSim.ini, The current directory is invalid.\n");
} catch (System.IO.PathTooLongException)
{
MainConsole.Instance.Output("Unable to Copy OpenSim.ini.example to OpenSim.ini, the Path to these files is too long.\n");
} catch (System.IO.DirectoryNotFoundException)
{
MainConsole.Instance.Output("Unable to Copy OpenSim.ini.example to OpenSim.ini, the current directory is reporting as not found.\n");
} catch (System.IO.FileNotFoundException)
{
MainConsole.Instance.Output("Unable to Copy OpenSim.ini.example to OpenSim.ini, the example is not found, please make sure that the example files exist.\n");
} catch (System.IO.IOException)
{
// Destination file exists already or a hard drive failure... .. so we can just drop this one
//MainConsole.Instance.Output("Unable to Copy OpenSim.ini.example to OpenSim.ini, the example is not found, please make sure that the example files exist.\n");
} catch (System.NotSupportedException)
{
MainConsole.Instance.Output("Unable to Copy OpenSim.ini.example to OpenSim.ini, The current directory is invalid.\n");
}
}
if (!(StanaloneCommon_ProperCased || StanaloneCommon_lowercased))
{
try
{
File.Copy(Path.Combine(Path.Combine(Util.configDir(), "config-include"), "StandaloneCommon.ini.example"),
Path.Combine(Path.Combine(Util.configDir(), "config-include"), "StandaloneCommon.ini"));
}
catch (UnauthorizedAccessException)
{
MainConsole.Instance.Output("Unable to Copy StandaloneCommon.ini.example to StandaloneCommon.ini, Make sure OpenSim has the required permissions\n");
}
catch (ArgumentException)
{
MainConsole.Instance.Output("Unable to Copy StandaloneCommon.ini.example to StandaloneCommon.ini, The current directory is invalid.\n");
}
catch (System.IO.PathTooLongException)
{
MainConsole.Instance.Output("Unable to Copy StandaloneCommon.ini.example to StandaloneCommon.ini, the Path to these files is too long.\n");
}
catch (System.IO.DirectoryNotFoundException)
{
MainConsole.Instance.Output("Unable to Copy StandaloneCommon.ini.example to StandaloneCommon.ini, the current directory is reporting as not found.\n");
}
catch (System.IO.FileNotFoundException)
{
MainConsole.Instance.Output("Unable to Copy StandaloneCommon.ini.example to StandaloneCommon.ini, the example is not found, please make sure that the example files exist.\n");
}
catch (System.IO.IOException)
{
// Destination file exists already or a hard drive failure... .. so we can just drop this one
//MainConsole.Instance.Output("Unable to Copy OpenSim.ini.example to OpenSim.ini, the example is not found, please make sure that the example files exist.\n");
}
catch (System.NotSupportedException)
{
MainConsole.Instance.Output("Unable to Copy StandaloneCommon.ini.example to StandaloneCommon.ini, The current directory is invalid.\n");
}
}
}
MainConsole.Instance = null;
}
configSource.Alias.AddAlias("On", true);
configSource.Alias.AddAlias("Off", false);
configSource.Alias.AddAlias("True", true);
@ -145,6 +251,8 @@ namespace OpenSim
// load Crash directory config
m_crashDir = configSource.Configs["Startup"].GetString("crash_dir", m_crashDir);
if (background)
{
m_sim = new OpenSimBackground(configSource);
@ -152,8 +260,14 @@ namespace OpenSim
}
else
{
m_sim = new OpenSim(configSource);
m_sim.Startup();
while (true)