Date: Sun, 30 Jun 2002 05:10:04 -0700 (PDT) From: W Gerald Hicks <gehicks@gehicks.dyndns.org> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/40017: [patch] allows config(8) to specify config metadata directory Message-ID: <200206301210.g5UCA4x5035631@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/40017; it has been noted by GNATS.
From: W Gerald Hicks <gehicks@gehicks.dyndns.org>
To: freebsd-gnats-submit@FreeBSD.org, gehicks@gehicks.dyndns.org
Cc:
Subject: Re: kern/40017: [patch] allows config(8) to specify config metadata
directory
Date: Sun, 30 Jun 2002 12:09:04 +0000
This is a multi-part message in MIME format.
--------------1E1DA5F85B1983B10AF22F07
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Ouch.
I fouled up the previous patch. We need to resolve the configuration
directory to keep from breaking /usr/src 'kernel' target. D'oh!
Replace the patch for config:main.c with this one
Cheers,
Jerry Hicks
gehicks@gehicks.dyndns.org
--------------1E1DA5F85B1983B10AF22F07
Content-Type: text/plain; charset=us-ascii;
name="config:main.c.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="config:main.c.patch"
Index: src/usr.sbin/config/main.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/config/main.c,v
retrieving revision 1.55
diff -u -r1.55 main.c
--- src/usr.sbin/config/main.c 25 Feb 2002 21:59:57 -0000 1.55
+++ src/usr.sbin/config/main.c 30 Jun 2002 07:46:02 -0000
@@ -68,16 +68,21 @@
#endif
#define CDIR "../compile/"
+#define CONFDIR "../../conf/"
char * PREFIX;
char destdir[MAXPATHLEN];
+char * srcdiropt;
char srcdir[MAXPATHLEN];
+char * confdiropt;
+char confdir[MAXPATHLEN];
int debugging;
int profiling;
static void configfile(void);
static void get_srcdir(void);
+static void get_confdir(void);
static void usage(void);
static void cleanheaders(char *);
@@ -99,14 +104,20 @@
char *p;
char xxx[MAXPATHLEN];
- while ((ch = getopt(argc, argv, "d:gp")) != -1)
+ while ((ch = getopt(argc, argv, "c:d:s:gp")) != -1)
switch (ch) {
+ case 'c':
+ confdiropt = strdup(optarg);
+ break;
case 'd':
if (*destdir == '\0')
strlcpy(destdir, optarg, sizeof(destdir));
else
errx(2, "directory already set");
break;
+ case 's':
+ srcdiropt = strdup(optarg);
+ break;
case 'g':
debugging++;
break;
@@ -136,6 +147,12 @@
strlcat(destdir, PREFIX, sizeof(destdir));
}
+ get_confdir();
+ len = strlen(confdir);
+ if(len && confdir[len - 1] != '/')
+ strlcat(confdir, "/", sizeof(confdir));
+ printf("XXXXX %s XXXXX\n", confdir);
+
p = path((char *)NULL);
if (stat(p, &buf)) {
if (mkdir(p, 0777))
@@ -183,9 +200,26 @@
static void
get_srcdir(void)
{
-
- if (realpath("../..", srcdir) == NULL)
+ if(srcdiropt) {
+ if(realpath(srcdiropt, srcdir) == NULL)
+ errx(2, "Unable to find root of source tree");
+ } else if (realpath("../..", srcdir) == NULL)
errx(2, "Unable to find root of source tree");
+}
+
+/*
+ * get_confdir
+ * determine the conf metadata directory and
+ * save that in confdir
+ */
+static void
+get_confdir(void)
+{
+ if(confdiropt) {
+ if(realpath(confdiropt, confdir) == NULL)
+ errx(2, "Unable to find configuration directory");
+ } else if (realpath(CONFDIR, confdir) == NULL)
+ errx(2, "Unable to find configuration directory");
}
static void
--------------1E1DA5F85B1983B10AF22F07--
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200206301210.g5UCA4x5035631>
