Skip to content

Commit

Permalink
xorp: rtrmgr: util.cc: Changed s_cfg_root and s_config_root and intro…
Browse files Browse the repository at this point in the history
…duced s_template_dir and s_target_dir

When current_root == build_root, changed s_cfg_root to be equal build_root, so the xorpsh and xorp_rtrmgr
would expect command and module bins in $BUILDDIR/lib/xorp/{bin, sbin} by default.

Changed s_config_file to be equal xorp_real_path(XORP_SRC_ROOT) + "/rtrmgr/config/xorp.conf",
so the xorpsh and xorp_rtrmgr would expect xorp.conf in subdir, where all example .conf files are,
by default.

Introduced s_template_dir and s_target_dir, so when xorpsh and xorp_rtrmgr are run from $BUILDDIR,
they would look for template files in $BUILDDIR/etc/templates and target files in $BUILDDIR/xrl/targets.
In other cases, they look for template files in s_cfg_root+"/share/xorp/templates" and for target files
in s_cfg_root+"/share/xorp/xrl/targets", like they used to do.

Signed-off-by: Igor Maravic <igorm@etf.rs>
  • Loading branch information
Igor Maravic authored and greearb committed Feb 17, 2012
1 parent 18ecead commit e97916e
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions xorp/rtrmgr/util.cc
Expand Up @@ -38,6 +38,8 @@

static string s_cfg_root;
static string s_bin_root;
static string s_template_dir;
static string s_target_dir;
static string s_config_file;

/**
Expand Down Expand Up @@ -131,6 +133,8 @@ xorp_path_init(const char* argv0)
s_bin_root = xr;
s_cfg_root = xr;
s_config_file = s_cfg_root + "/etc/xorp.conf";
s_template_dir = s_cfg_root + "/share/xorp/templates";
s_target_dir = s_cfg_root + "/share/xorp/xrl/targets";
return;
}

Expand All @@ -145,11 +149,15 @@ xorp_path_init(const char* argv0)
debug_msg("build_root: %s\n", build_root.c_str());
if (current_root == build_root) {
s_bin_root = build_root;
s_cfg_root = xorp_real_path(XORP_SRC_ROOT);
s_config_file = s_cfg_root + "/rtrmgr/xorp.conf";
s_cfg_root = build_root;
s_template_dir = s_cfg_root + "/etc/templates";
s_target_dir = s_cfg_root + "/xrl/targets";
s_config_file = xorp_real_path(XORP_SRC_ROOT) + "/rtrmgr/config/xorp.conf";

debug_msg("s_bin_root: %s\n", s_bin_root.c_str());
debug_msg("s_cfg_root: %s\n", s_cfg_root.c_str());
debug_msg("s_template_dir: %s\n",s_template_dir.c_str());
debug_msg("s_target_dir: %s\n",s_target_dir.c_str());
debug_msg("s_config_file: %s\n", s_config_file.c_str());

return;
Expand All @@ -158,10 +166,14 @@ xorp_path_init(const char* argv0)
string install_root = xorp_real_path(XORP_INSTALL_ROOT);
s_bin_root = install_root;
s_cfg_root = install_root;
s_template_dir = s_cfg_root + "/share/xorp/templates";
s_target_dir = s_cfg_root + "/share/xorp/xrl/targets";
s_config_file = s_cfg_root + "/etc/xorp.conf";

debug_msg("s_bin_root: %s\n", s_bin_root.c_str());
debug_msg("s_cfg_root: %s\n", s_cfg_root.c_str());
debug_msg("s_template_dir: %s\n",s_template_dir.c_str());
debug_msg("s_target_dir: %s\n",s_target_dir.c_str());
debug_msg("s_config_file: %s\n", s_config_file.c_str());
}

Expand Down Expand Up @@ -192,13 +204,13 @@ xorp_command_dir()
string
xorp_template_dir()
{
return s_cfg_root + string("/share/xorp/templates");
return s_template_dir;
}

string
xorp_xrl_targets_dir()
{
return s_cfg_root + string("/share/xorp/xrl/targets");
return s_target_dir;
}

string
Expand Down

0 comments on commit e97916e

Please sign in to comment.