Add an option to fork ldconfig in env-update, #182794. Also, preserve the entire line in /etc/env.d/foo if it begins with $
This commit is contained in:
parent
e03844fd26
commit
53d17a1be2
|
@ -1,6 +1,10 @@
|
||||||
# ChangeLog for Gentoo System Intialization ("rc") scripts
|
# ChangeLog for Gentoo System Intialization ("rc") scripts
|
||||||
# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPLv2
|
# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPLv2
|
||||||
|
|
||||||
|
09 Jul 2007; Roy Marples <uberlord@gentoo.org>:
|
||||||
|
|
||||||
|
Add an option to fork ldconfig in env-update, #182794
|
||||||
|
|
||||||
06 Jul 2007; Roy Marples <uberlord@gentoo.org>:
|
06 Jul 2007; Roy Marples <uberlord@gentoo.org>:
|
||||||
|
|
||||||
Add and delete IPv6 addresses and routes correctly on FreeBSD, #184430
|
Add and delete IPv6 addresses and routes correctly on FreeBSD, #184430
|
||||||
|
|
|
@ -42,7 +42,7 @@ start() {
|
||||||
ebegin "Updating environment"
|
ebegin "Updating environment"
|
||||||
# As runscript prefixes our path with /$LIBDIR/rcscripts/bin, our
|
# As runscript prefixes our path with /$LIBDIR/rcscripts/bin, our
|
||||||
# version instead of the portage version should be found first.
|
# version instead of the portage version should be found first.
|
||||||
env-update
|
env-update --fork-ldconfig
|
||||||
eend $?
|
eend $?
|
||||||
|
|
||||||
# Take care of random stuff [ /var/lock | /var/run | pam ]
|
# Take care of random stuff [ /var/lock | /var/run | pam ]
|
||||||
|
|
|
@ -64,6 +64,7 @@ static char *applet = NULL;
|
||||||
#include "_usage.h"
|
#include "_usage.h"
|
||||||
#define getoptstring "L" getoptstring_COMMON
|
#define getoptstring "L" getoptstring_COMMON
|
||||||
static struct option longopts[] = {
|
static struct option longopts[] = {
|
||||||
|
{ "fork-ldconfig", 0, NULL, 'l'},
|
||||||
{ "no-ldconfig", 0, NULL, 'L'},
|
{ "no-ldconfig", 0, NULL, 'L'},
|
||||||
longopts_COMMON
|
longopts_COMMON
|
||||||
{ NULL, 0, NULL, 0}
|
{ NULL, 0, NULL, 0}
|
||||||
|
@ -89,6 +90,7 @@ int main (int argc, char **argv)
|
||||||
char **myspaces = NULL;
|
char **myspaces = NULL;
|
||||||
int opt;
|
int opt;
|
||||||
bool ldconfig = true;
|
bool ldconfig = true;
|
||||||
|
bool fork_ldconfig = false;
|
||||||
|
|
||||||
applet = argv[0];
|
applet = argv[0];
|
||||||
|
|
||||||
|
@ -96,6 +98,9 @@ int main (int argc, char **argv)
|
||||||
longopts, (int *) 0)) != -1)
|
longopts, (int *) 0)) != -1)
|
||||||
{
|
{
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
|
case 'l':
|
||||||
|
fork_ldconfig = true;
|
||||||
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
ldconfig = false;
|
ldconfig = false;
|
||||||
break;
|
break;
|
||||||
|
@ -219,8 +224,12 @@ int main (int argc, char **argv)
|
||||||
char *tmpent = rc_xstrdup (env);
|
char *tmpent = rc_xstrdup (env);
|
||||||
char *value = tmpent;
|
char *value = tmpent;
|
||||||
char *var = strsep (&value, "=");
|
char *var = strsep (&value, "=");
|
||||||
if (strcmp (var, "LDPATH") != 0)
|
if (strcmp (var, "LDPATH") != 0) {
|
||||||
fprintf (fp, "export %s='%s'\n", var, value);
|
if (*value == '$')
|
||||||
|
fprintf (fp, "export %s=%s\n", var, value);
|
||||||
|
else
|
||||||
|
fprintf (fp, "export %s='%s'\n", var, value);
|
||||||
|
}
|
||||||
free (tmpent);
|
free (tmpent);
|
||||||
}
|
}
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
|
@ -233,8 +242,12 @@ int main (int argc, char **argv)
|
||||||
char *tmpent = rc_xstrdup (env);
|
char *tmpent = rc_xstrdup (env);
|
||||||
char *value = tmpent;
|
char *value = tmpent;
|
||||||
char *var = strsep (&value, "=");
|
char *var = strsep (&value, "=");
|
||||||
if (strcmp (var, "LDPATH") != 0)
|
if (strcmp (var, "LDPATH") != 0) {
|
||||||
fprintf (fp, "setenv %s '%s'\n", var, value);
|
if (*value == '$')
|
||||||
|
fprintf (fp, "setenv %s %s\n", var, value);
|
||||||
|
else
|
||||||
|
fprintf (fp, "setenv %s '%s'\n", var, value);
|
||||||
|
}
|
||||||
free (tmpent);
|
free (tmpent);
|
||||||
}
|
}
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
|
@ -275,6 +288,7 @@ int main (int argc, char **argv)
|
||||||
|
|
||||||
if (ld) {
|
if (ld) {
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
pid_t pid = getpid ();
|
||||||
|
|
||||||
if ((fp = fopen (LDSOCONF, "w")) == NULL)
|
if ((fp = fopen (LDSOCONF, "w")) == NULL)
|
||||||
eerrorx ("%s: fopen `%s': %s", applet, LDSOCONF,
|
eerrorx ("%s: fopen `%s': %s", applet, LDSOCONF,
|
||||||
|
@ -284,14 +298,22 @@ int main (int argc, char **argv)
|
||||||
fprintf (fp, "%s\n", ldent);
|
fprintf (fp, "%s\n", ldent);
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
|
|
||||||
|
if (fork_ldconfig) {
|
||||||
|
if ((pid = fork ()) == -1)
|
||||||
|
eerror ("%s: failed to fork: %s", applet,
|
||||||
|
strerror (errno));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pid) {
|
||||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||||
ebegin ("Regenerating /var/run/ld-elf.so.hints");
|
ebegin ("Regenerating /var/run/ld-elf.so.hints");
|
||||||
retval = system ("/sbin/ldconfig -elf -i '" LDSOCONF "'");
|
retval = system ("/sbin/ldconfig -elf -i '" LDSOCONF "'");
|
||||||
#else
|
#else
|
||||||
ebegin ("Regenerating /etc/ld.so.cache");
|
ebegin ("Regenerating /etc/ld.so.cache");
|
||||||
retval = system ("/sbin/ldconfig");
|
retval = system ("/sbin/ldconfig");
|
||||||
#endif
|
#endif
|
||||||
eend (retval, NULL);
|
eend (retval, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -336,10 +336,14 @@ char **rc_get_config (char **list, const char *file)
|
||||||
|
|
||||||
entry = rc_xstrdup (token);
|
entry = rc_xstrdup (token);
|
||||||
|
|
||||||
do {
|
/* Preserve shell coloring */
|
||||||
/* Bash variables are usually quoted */
|
if (*p == '$')
|
||||||
token = strsep (&p, "\"\'");
|
token = p;
|
||||||
} while ((token) && (strlen (token) == 0));
|
else
|
||||||
|
do {
|
||||||
|
/* Bash variables are usually quoted */
|
||||||
|
token = strsep (&p, "\"\'");
|
||||||
|
} while ((token) && (strlen (token) == 0));
|
||||||
|
|
||||||
/* Drop a newline if that's all we have */
|
/* Drop a newline if that's all we have */
|
||||||
i = strlen (token) - 1;
|
i = strlen (token) - 1;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user