./configure -with-hook=ntp.conf
Some system services expose the name of the service we are in,
-by default dhcpcd will pick SVCNAME from the environment.
-You can override this in CPPFLAGS+= -DSVCNAME="RC_SVCNAME".
+by default dhcpcd will pick RC_SVCNAME from the environment.
+You can override this in CPPFLAGS+= -DRC_SVCNAME="YOUR_SVCNAME".
This is important because dhcpcd will scrub the environment aside from $PATH
before running hooks.
This variable could be used to facilitate service re-entry so this chain could
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd September 9, 2014
+.Dd September 12, 2014
.Dt DHCPCD-RUN-HOOKS 8
.Os
.Sh NAME
will clear the environment variables aside from
.Ev $PATH
and
-.Ev $SVCNAME .
+.Ev $RC_SVCNAME .
The following variables will then be set, along with any protocol supplied
ones.
.Bl -tag -width Xinterface_order
#endif
/* Allow the OS to define another script env var name */
-#ifndef SVCNAME
-#define SVCNAME "SVCNAME"
+#ifndef RC_SVCNAME
+#define RC_SVCNAME "RC_SVCNAME"
#endif
#define DEFAULT_PATH "PATH=/usr/bin:/usr/sbin:/bin:/sbin"
syslog(LOG_ERR, "%s: make_env: %m", ifp->name);
return -1;
}
- /* Resize for PATH and SVCNAME */
- svcname = getenv(SVCNAME);
+ /* Resize for PATH and RC_SVCNAME */
+ svcname = getenv(RC_SVCNAME);
ep = realloc(env, sizeof(char *) * (elen + 2 + (svcname ? 1 : 0)));
if (ep == NULL) {
elen = 0;
}
}
if (svcname) {
- e = strlen(SVCNAME) + strlen(svcname) + 2;
+ e = strlen(RC_SVCNAME) + strlen(svcname) + 2;
env[++elen] = malloc(e);
if (env[elen] == NULL) {
elen = 0;
goto out;
}
- snprintf(env[elen], e, "%s=%s", SVCNAME, svcname);
+ snprintf(env[elen], e, "%s=%s", RC_SVCNAME, svcname);
}
env[++elen] = NULL;