2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-31 06:15:55 +00:00

Support environment variables to control locations of files.

This commit is contained in:
Ted Lemon
2000-07-17 20:56:14 +00:00
parent 47082c658b
commit cfa7212d26
3 changed files with 42 additions and 3 deletions

View File

@@ -41,7 +41,7 @@
#ifndef lint
static char ocopyright[] =
"$Id: dhclient.c,v 1.106 2000/06/24 06:02:01 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 Internet Software Consortium. All rights reserved.\n";
"$Id: dhclient.c,v 1.107 2000/07/17 20:56:11 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -104,6 +104,10 @@ int main (argc, argv, envp)
isc_result_t result;
int persist = 0;
int omapi_port;
int no_dhclient_conf = 0;
int no_dhclient_db = 0;
int no_dhclient_pid = 0;
char *s;
#ifdef SYSLOG_4_2
openlog ("dhclient", LOG_NDELAY);
@@ -147,14 +151,17 @@ int main (argc, argv, envp)
if (++i == argc)
usage ();
path_dhclient_pid = argv [i];
no_dhclient_pid = 1;
} else if (!strcmp (argv [i], "-cf")) {
if (++i == argc)
usage ();
path_dhclient_conf = argv [i];
no_dhclient_conf = 1;
} else if (!strcmp (argv [i], "-lf")) {
if (++i == argc)
usage ();
path_dhclient_db = argv [i];
no_dhclient_db = 1;
} else if (!strcmp (argv [i], "-q")) {
quiet = 1;
quiet_interface_discovery = 1;
@@ -195,6 +202,16 @@ int main (argc, argv, envp)
}
}
if (!no_dhclient_conf && (s = getenv ("PATH_DHCLIENT_CONF"))) {
path_dhclient_conf = s;
}
if (!no_dhclient_db && (s = getenv ("PATH_DHCLIENT_DB"))) {
path_dhclient_db = s;
}
if (!no_dhclient_pid && (s = getenv ("PATH_DHCLIENT_PID"))) {
path_dhclient_pid = s;
}
/* first kill of any currently running client */
if (release_mode) {
/* XXX inelegant hack to prove concept */
@@ -2168,6 +2185,7 @@ void script_write_params (client, prefix, lease)
struct data_string data;
struct option_cache *oc;
pair *hash;
char *s, *t;
fprintf (scriptFile, "%sip_address=\"%s\"\n",
prefix, piaddr (lease -> address));