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
|
||||
# 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>:
|
||||
|
||||
Add and delete IPv6 addresses and routes correctly on FreeBSD, #184430
|
||||
|
@ -42,7 +42,7 @@ start() {
|
||||
ebegin "Updating environment"
|
||||
# As runscript prefixes our path with /$LIBDIR/rcscripts/bin, our
|
||||
# version instead of the portage version should be found first.
|
||||
env-update
|
||||
env-update --fork-ldconfig
|
||||
eend $?
|
||||
|
||||
# Take care of random stuff [ /var/lock | /var/run | pam ]
|
||||
|
@ -64,6 +64,7 @@ static char *applet = NULL;
|
||||
#include "_usage.h"
|
||||
#define getoptstring "L" getoptstring_COMMON
|
||||
static struct option longopts[] = {
|
||||
{ "fork-ldconfig", 0, NULL, 'l'},
|
||||
{ "no-ldconfig", 0, NULL, 'L'},
|
||||
longopts_COMMON
|
||||
{ NULL, 0, NULL, 0}
|
||||
@ -89,6 +90,7 @@ int main (int argc, char **argv)
|
||||
char **myspaces = NULL;
|
||||
int opt;
|
||||
bool ldconfig = true;
|
||||
bool fork_ldconfig = false;
|
||||
|
||||
applet = argv[0];
|
||||
|
||||
@ -96,6 +98,9 @@ int main (int argc, char **argv)
|
||||
longopts, (int *) 0)) != -1)
|
||||
{
|
||||
switch (opt) {
|
||||
case 'l':
|
||||
fork_ldconfig = true;
|
||||
break;
|
||||
case 'L':
|
||||
ldconfig = false;
|
||||
break;
|
||||
@ -219,8 +224,12 @@ int main (int argc, char **argv)
|
||||
char *tmpent = rc_xstrdup (env);
|
||||
char *value = tmpent;
|
||||
char *var = strsep (&value, "=");
|
||||
if (strcmp (var, "LDPATH") != 0)
|
||||
fprintf (fp, "export %s='%s'\n", var, value);
|
||||
if (strcmp (var, "LDPATH") != 0) {
|
||||
if (*value == '$')
|
||||
fprintf (fp, "export %s=%s\n", var, value);
|
||||
else
|
||||
fprintf (fp, "export %s='%s'\n", var, value);
|
||||
}
|
||||
free (tmpent);
|
||||
}
|
||||
fclose (fp);
|
||||
@ -233,8 +242,12 @@ int main (int argc, char **argv)
|
||||
char *tmpent = rc_xstrdup (env);
|
||||
char *value = tmpent;
|
||||
char *var = strsep (&value, "=");
|
||||
if (strcmp (var, "LDPATH") != 0)
|
||||
fprintf (fp, "setenv %s '%s'\n", var, value);
|
||||
if (strcmp (var, "LDPATH") != 0) {
|
||||
if (*value == '$')
|
||||
fprintf (fp, "setenv %s %s\n", var, value);
|
||||
else
|
||||
fprintf (fp, "setenv %s '%s'\n", var, value);
|
||||
}
|
||||
free (tmpent);
|
||||
}
|
||||
fclose (fp);
|
||||
@ -275,6 +288,7 @@ int main (int argc, char **argv)
|
||||
|
||||
if (ld) {
|
||||
int retval = 0;
|
||||
pid_t pid = getpid ();
|
||||
|
||||
if ((fp = fopen (LDSOCONF, "w")) == NULL)
|
||||
eerrorx ("%s: fopen `%s': %s", applet, LDSOCONF,
|
||||
@ -284,14 +298,22 @@ int main (int argc, char **argv)
|
||||
fprintf (fp, "%s\n", ldent);
|
||||
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__)
|
||||
ebegin ("Regenerating /var/run/ld-elf.so.hints");
|
||||
retval = system ("/sbin/ldconfig -elf -i '" LDSOCONF "'");
|
||||
ebegin ("Regenerating /var/run/ld-elf.so.hints");
|
||||
retval = system ("/sbin/ldconfig -elf -i '" LDSOCONF "'");
|
||||
#else
|
||||
ebegin ("Regenerating /etc/ld.so.cache");
|
||||
retval = system ("/sbin/ldconfig");
|
||||
ebegin ("Regenerating /etc/ld.so.cache");
|
||||
retval = system ("/sbin/ldconfig");
|
||||
#endif
|
||||
eend (retval, NULL);
|
||||
eend (retval, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -336,10 +336,14 @@ char **rc_get_config (char **list, const char *file)
|
||||
|
||||
entry = rc_xstrdup (token);
|
||||
|
||||
do {
|
||||
/* Bash variables are usually quoted */
|
||||
token = strsep (&p, "\"\'");
|
||||
} while ((token) && (strlen (token) == 0));
|
||||
/* Preserve shell coloring */
|
||||
if (*p == '$')
|
||||
token = p;
|
||||
else
|
||||
do {
|
||||
/* Bash variables are usually quoted */
|
||||
token = strsep (&p, "\"\'");
|
||||
} while ((token) && (strlen (token) == 0));
|
||||
|
||||
/* Drop a newline if that's all we have */
|
||||
i = strlen (token) - 1;
|
||||
|
Loading…
Reference in New Issue
Block a user