build: replace some hardcoding with ./configure

Several places have paths and names that can change hardcoded, e.g. the
package name and the /var/run path.  This fixes a few of them, there's
still some to do.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
David Lamparter 2016-12-20 18:10:30 +01:00
parent 3bd82ffb70
commit ae435b1972
6 changed files with 14 additions and 10 deletions

View file

@ -31,6 +31,7 @@
#include "smux.h"
#include "memory.h"
#include "linklist.h"
#include "version.h"
static int agentx_enabled = 0;
@ -175,7 +176,7 @@ DEFUN (agentx_enable,
{
if (!agentx_enabled)
{
init_snmp("quagga");
init_snmp(FRR_SMUX_NAME);
events = list_new();
agentx_events_update ();
agentx_enabled = 1;
@ -209,7 +210,7 @@ smux_init (struct thread_master *tm)
SNMP_CALLBACK_LOGGING,
agentx_log_callback,
NULL);
init_agent ("quagga");
init_agent (FRR_SMUX_NAME);
install_node (&agentx_node, config_write_agentx);
install_element (CONFIG_NODE, &agentx_enable_cmd);

View file

@ -37,6 +37,7 @@
#define FRR_PAM_NAME "@PACKAGE_NAME@"
#define FRR_SMUX_NAME "@PACKAGE_NAME@"
#define FRR_PTM_NAME "@PACKAGE_NAME@"
#define FRR_FULL_NAME "FreeRangeRouting"
#define FRR_VERSION "@PACKAGE_VERSION@" GIT_SUFFIX

View file

@ -360,8 +360,8 @@ main (int argc, char **argv)
/* Create VTY socket */
if (instance)
{
sprintf(pid_file, "/var/run/quagga/ospfd-%d.pid", instance);
sprintf(vty_path, "/var/run/quagga/ospfd-%d.vty", instance);
sprintf(pid_file, "%s/ospfd-%d.pid", DAEMON_VTY_DIR, instance);
sprintf(vty_path, "%s/ospfd-%d.vty", DAEMON_VTY_DIR, instance);
}
else
{

View file

@ -2999,8 +2999,8 @@ vtysh_update_all_insances(struct vtysh_client * head_client)
if (head_client->flag != VTYSH_OSPFD) return;
/* ls /var/run/quagga/ and look for all files ending in .vty */
dir = opendir("/var/run/quagga/");
/* ls DAEMON_VTY_DIR and look for all files ending in .vty */
dir = opendir(DAEMON_VTY_DIR "/");
if (dir)
{
while ((file = readdir(dir)) != NULL)
@ -3010,7 +3010,8 @@ vtysh_update_all_insances(struct vtysh_client * head_client)
if (n == MAXIMUM_INSTANCES)
{
fprintf(stderr,
"Parsing /var/run/quagga/, client limit(%d) reached!\n", n);
"Parsing %s/, client limit(%d) reached!\n",
DAEMON_VTY_DIR, n);
break;
}
client = (struct vtysh_client *) malloc(sizeof(struct vtysh_client));
@ -3018,7 +3019,7 @@ vtysh_update_all_insances(struct vtysh_client * head_client)
client->name = "ospfd";
client->flag = VTYSH_OSPFD;
ptr = (char *) malloc(100);
sprintf(ptr, "/var/run/quagga/%s", file->d_name);
sprintf(ptr, "%s/%s", DAEMON_VTY_DIR, file->d_name);
client->path = (const char *)ptr;
client->next = NULL;
vtysh_client_sorted_insert(head_client, client);

View file

@ -706,7 +706,7 @@ daemon_send_ready (void)
#if defined (HAVE_CUMULUS)
FILE *fp;
fp = fopen("/var/run/quagga/watchquagga.started", "w");
fp = fopen(DAEMON_VTY_DIR "/watchquagga.started", "w");
fclose(fp);
#endif
zlog_notice ("Watchquagga: Notifying Systemd we are up and running");

View file

@ -38,6 +38,7 @@
#include "vrf.h"
#include "rib.h"
#include "zebra_vrf.h"
#include "version.h"
#define ZEBRA_PTM_RECONNECT_TIME_INITIAL 1 /* initial reconnect is 1s */
#define ZEBRA_PTM_RECONNECT_TIME_MAX 300
@ -119,7 +120,7 @@ zebra_ptm_init (void)
ptm_cb.pid = getpid();
zebra_ptm_install_commands();
sprintf(buf, "%s", "quagga");
sprintf(buf, "%s", FRR_PTM_NAME);
ptm_hdl = ptm_lib_register(buf, NULL, zebra_ptm_handle_msg_cb,
zebra_ptm_handle_msg_cb);
ptm_cb.wb = buffer_new(0);