Remove hardcoded paths to commands, configs, etc. in source
This commit is contained in:
parent
72db8edf3f
commit
b9ed302de1
6 changed files with 48 additions and 14 deletions
|
|
@ -166,7 +166,7 @@ install-include: clixon_backend.h clixon_backend_client.h clixon_backend_transac
|
|||
.SUFFIXES: .c .o
|
||||
|
||||
.c.o:
|
||||
$(CC) $(INCLUDES) $(CPPFLAGS) -D__PROGRAM__=\"$(APPL)\" -DCLIXON_CONFIG_SBINDIR=\"$(sbindir)\" $(CFLAGS) -c $<
|
||||
$(CC) $(INCLUDES) $(CPPFLAGS) -D__PROGRAM__=\"$(APPL)\" $(CFLAGS) -c $<
|
||||
|
||||
# Just link test programs
|
||||
test.c :
|
||||
|
|
|
|||
23
configure
vendored
23
configure
vendored
|
|
@ -6602,6 +6602,24 @@ then :
|
|||
fi
|
||||
|
||||
|
||||
# Default location for config file
|
||||
|
||||
printf "%s\n" "#define CLIXON_DEFAULT_CONFIG \"${CLIXON_DEFAULT_CONFIG}\"" >>confdefs.h
|
||||
|
||||
|
||||
|
||||
printf "%s\n" "#define CLIXON_CONFIG_BINDIR \"${BINDIR}\"" >>confdefs.h
|
||||
|
||||
|
||||
printf "%s\n" "#define CLIXON_CONFIG_LOCALSTATEDIR \"${LOCALSTATEDIR}\"" >>confdefs.h
|
||||
|
||||
|
||||
printf "%s\n" "#define CLIXON_CONFIG_SBINDIR \"${SBINDIR}\"" >>confdefs.h
|
||||
|
||||
|
||||
printf "%s\n" "#define CLIXON_CONFIG_SYSCONFDIR \"${SYSCONFDIR}\"" >>confdefs.h
|
||||
|
||||
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for socket in -lsocket" >&5
|
||||
printf %s "checking for socket in -lsocket... " >&6; }
|
||||
if test ${ac_cv_lib_socket_socket+y}
|
||||
|
|
@ -6931,11 +6949,6 @@ if test -n "${CLICON_GROUP}"; then
|
|||
echo "Using CLICON_GROUP here: ${CLICON_GROUP}"
|
||||
fi
|
||||
|
||||
# Default location for config file
|
||||
|
||||
printf "%s\n" "#define CLIXON_DEFAULT_CONFIG \"${CLIXON_DEFAULT_CONFIG}\"" >>confdefs.h
|
||||
|
||||
|
||||
# Dummy to disable native language support (nls) to remove warnings in buildroot
|
||||
# Check whether --enable-nls was given.
|
||||
if test ${enable_nls+y}
|
||||
|
|
|
|||
11
configure.ac
11
configure.ac
|
|
@ -361,6 +361,14 @@ AC_ARG_WITH([configfile],
|
|||
[AS_HELP_STRING([--with-configfile=FILE],[Set default path to config file])],
|
||||
[CLIXON_DEFAULT_CONFIG="$withval"],)
|
||||
|
||||
# Default location for config file
|
||||
AC_DEFINE_UNQUOTED(CLIXON_DEFAULT_CONFIG,"${CLIXON_DEFAULT_CONFIG}",[Location for apps to find default config file])
|
||||
|
||||
AC_DEFINE_UNQUOTED(CLIXON_CONFIG_BINDIR, "${BINDIR}", [Pass-through $bindir])
|
||||
AC_DEFINE_UNQUOTED(CLIXON_CONFIG_LOCALSTATEDIR, "${LOCALSTATEDIR}", [Pass-through $localstatedir])
|
||||
AC_DEFINE_UNQUOTED(CLIXON_CONFIG_SBINDIR, "${SBINDIR}", [Pass-through $sbindir])
|
||||
AC_DEFINE_UNQUOTED(CLIXON_CONFIG_SYSCONFDIR, "${SYSCONFDIR}", [Pass-through $sysconfdir])
|
||||
|
||||
AC_CHECK_LIB(socket, socket)
|
||||
AC_CHECK_LIB(dl, dlopen)
|
||||
|
||||
|
|
@ -443,9 +451,6 @@ if test -n "${CLICON_GROUP}"; then
|
|||
echo "Using CLICON_GROUP here: ${CLICON_GROUP}"
|
||||
fi
|
||||
|
||||
# Default location for config file
|
||||
AC_DEFINE_UNQUOTED(CLIXON_DEFAULT_CONFIG,"${CLIXON_DEFAULT_CONFIG}",[Location for apps to find default config file])
|
||||
|
||||
# Dummy to disable native language support (nls) to remove warnings in buildroot
|
||||
AC_ARG_ENABLE(nls)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,17 @@
|
|||
/* include/clixon_config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Pass-through $bindir */
|
||||
#undef CLIXON_CONFIG_BINDIR
|
||||
|
||||
/* Pass-through $localstatedir */
|
||||
#undef CLIXON_CONFIG_LOCALSTATEDIR
|
||||
|
||||
/* Pass-through $sbindir */
|
||||
#undef CLIXON_CONFIG_SBINDIR
|
||||
|
||||
/* Pass-through $sysconfdir */
|
||||
#undef CLIXON_CONFIG_SYSCONFDIR
|
||||
|
||||
/* Location for apps to find default config file */
|
||||
#undef CLIXON_DEFAULT_CONFIG
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@
|
|||
/* Netconf binary default, override with environment variable: CLIXON_NETCONF_BIN
|
||||
* Could try to get path from install/makefile data
|
||||
*/
|
||||
#define CLIXON_NETCONF_BIN "/usr/local/bin/clixon_netconf"
|
||||
#define CLIXON_NETCONF_BIN CLIXON_CONFIG_BINDIR "/clixon_netconf"
|
||||
|
||||
#define CLIXON_CLIENT_MAGIC 0x54fe649a
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,10 @@ sudo clixon_netconf_ssh_callhome -a 127.0.0.1 -c /var/tmp/./test_netconf_ssh_cal
|
|||
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "clixon_config.h" /* generated by config & autoconf */
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
|
@ -79,7 +83,7 @@ sudo clixon_netconf_ssh_callhome -a 127.0.0.1 -c /var/tmp/./test_netconf_ssh_cal
|
|||
#include <sys/socket.h>
|
||||
|
||||
#define NETCONF_CH_SSH 4334
|
||||
#define SSHDBIN_DEFAULT "/usr/sbin/sshd"
|
||||
#define SSHDBIN_DEFAULT CLIXON_CONFIG_SBINDIR "/sshd"
|
||||
#define UTIL_OPTS "hD:f:a:p:s:c:C:"
|
||||
|
||||
static int
|
||||
|
|
@ -151,7 +155,7 @@ ssh_server_exec(int s,
|
|||
int nr;
|
||||
char *optstr = NULL;
|
||||
size_t len;
|
||||
const char *formatstr = "Subsystem netconf /usr/local/bin/clixon_netconf -f %s";
|
||||
const char *formatstr = "Subsystem netconf " CLIXON_CONFIG_BINDIR "/clixon_netconf -f %s";
|
||||
|
||||
if (s < 0){
|
||||
errno = EINVAL;
|
||||
|
|
@ -237,7 +241,7 @@ usage(char *argv0)
|
|||
"\t-f ipv4|ipv6 \tSocket address family(inet:ipv4-address default)\n"
|
||||
"\t-a <addrstr> \tIP address (eg 1.2.3.4) - mandatory\n"
|
||||
"\t-p <port> \tPort (default 4334)\n"
|
||||
"\t-c <file> \tClixon config file - (default /usr/local/etc/clixon.xml)\n"
|
||||
"\t-c <file> \tClixon config file - (default " CLIXON_DEFAULT_CONFIG ")\n"
|
||||
"\t-C <file> \tSSHD config file - (default /dev/null)\n"
|
||||
"\t-s <sshd> \tPath to sshd binary, default %s\n"
|
||||
,
|
||||
|
|
@ -261,7 +265,7 @@ main(int argc,
|
|||
int s = -1;
|
||||
char *sshdbin = SSHDBIN_DEFAULT;
|
||||
char *sshdconfigfile = "/dev/null";
|
||||
char *clixonconfigfile = "/usr/local/etc/clixon.xml";
|
||||
char *clixonconfigfile = CLIXON_CONFIG_SYSCONFDIR "/clixon.xml";
|
||||
|
||||
optind = 1;
|
||||
opterr = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue