Add --no-ldconfig option to env-update to match portage.
This commit is contained in:
parent
f9220d3e28
commit
10c3592147
@ -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
|
||||||
|
|
||||||
|
27 Jun 2007; Roy Marples <uberlord@gentoo.org>:
|
||||||
|
|
||||||
|
Add --no-ldconfig option to env-update to match portage.
|
||||||
|
|
||||||
26 Jun 2007; Roy Marples <uberlord@gentoo.org>:
|
26 Jun 2007; Roy Marples <uberlord@gentoo.org>:
|
||||||
|
|
||||||
--nocolor works again, #181011 thanks to Daniel Drake.
|
--nocolor works again, #181011 thanks to Daniel Drake.
|
||||||
|
@ -8,7 +8,10 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define APPLET "env-update"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <getopt.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -58,6 +61,14 @@ static const char *space_separated[] = {
|
|||||||
|
|
||||||
static char *applet = NULL;
|
static char *applet = NULL;
|
||||||
|
|
||||||
|
#define getoptstring "hL"
|
||||||
|
static struct option longopts[] = {
|
||||||
|
{ "help", 0, NULL, 'h'},
|
||||||
|
{ "no-ldconfig", 0, NULL, 'L'},
|
||||||
|
{ NULL, 0, NULL, 0}
|
||||||
|
};
|
||||||
|
#include "_usage.c"
|
||||||
|
|
||||||
int main (int argc, char **argv)
|
int main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
char **files = rc_ls_dir (NULL, ENVDIR, 0);
|
char **files = rc_ls_dir (NULL, ENVDIR, 0);
|
||||||
@ -75,9 +86,24 @@ int main (int argc, char **argv)
|
|||||||
char *entry;
|
char *entry;
|
||||||
char **mycolons = NULL;
|
char **mycolons = NULL;
|
||||||
char **myspaces = NULL;
|
char **myspaces = NULL;
|
||||||
|
int opt;
|
||||||
|
bool ldconfig = true;
|
||||||
|
|
||||||
applet = argv[0];
|
applet = argv[0];
|
||||||
|
|
||||||
|
while ((opt = getopt_long (argc, argv, getoptstring,
|
||||||
|
longopts, (int *) 0)) != -1)
|
||||||
|
{
|
||||||
|
switch (opt) {
|
||||||
|
case 'L':
|
||||||
|
ldconfig = false;
|
||||||
|
break;
|
||||||
|
case 'h':
|
||||||
|
usage (EXIT_SUCCESS);
|
||||||
|
default:
|
||||||
|
usage (EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (! files)
|
if (! files)
|
||||||
eerrorx ("%s: no files in " ENVDIR " to process", applet);
|
eerrorx ("%s: no files in " ENVDIR " to process", applet);
|
||||||
|
|
||||||
@ -230,40 +256,43 @@ int main (int argc, char **argv)
|
|||||||
nents++;
|
nents++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update ld.so.conf only if different */
|
if (ldconfig) {
|
||||||
if (rc_exists (LDSOCONF)) {
|
/* Update ld.so.conf only if different */
|
||||||
char **lines = rc_get_list (NULL, LDSOCONF);
|
if (rc_exists (LDSOCONF)) {
|
||||||
char *line;
|
char **lines = rc_get_list (NULL, LDSOCONF);
|
||||||
ld = false;
|
char *line;
|
||||||
STRLIST_FOREACH (lines, line, i)
|
ld = false;
|
||||||
if (i > nents || strcmp (line, ldents[i - 1]) != 0)
|
STRLIST_FOREACH (lines, line, i)
|
||||||
{
|
if (i > nents || strcmp (line, ldents[i - 1]) != 0)
|
||||||
|
{
|
||||||
|
ld = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
rc_strlist_free (lines);
|
||||||
|
if (i - 1 != nents)
|
||||||
ld = true;
|
ld = true;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
rc_strlist_free (lines);
|
|
||||||
if (i - 1 != nents)
|
|
||||||
ld = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ld) {
|
if (ld) {
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
|
||||||
if ((fp = fopen (LDSOCONF, "w")) == NULL)
|
if ((fp = fopen (LDSOCONF, "w")) == NULL)
|
||||||
eerrorx ("%s: fopen `%s': %s", applet, LDSOCONF, strerror (errno));
|
eerrorx ("%s: fopen `%s': %s", applet, LDSOCONF,
|
||||||
fprintf (fp, LDNOTICE);
|
strerror (errno));
|
||||||
STRLIST_FOREACH (ldents, ldent, i)
|
fprintf (fp, LDNOTICE);
|
||||||
fprintf (fp, "%s\n", ldent);
|
STRLIST_FOREACH (ldents, ldent, i)
|
||||||
fclose (fp);
|
fprintf (fp, "%s\n", ldent);
|
||||||
|
fclose (fp);
|
||||||
|
|
||||||
#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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rc_strlist_free (ldents);
|
rc_strlist_free (ldents);
|
||||||
|
Loading…
Reference in New Issue
Block a user