bug-sourceinstall
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-sourceinstall] Re: patch to allow alternate location for .sourceins


From: Claudio Fontana
Subject: [bug-sourceinstall] Re: patch to allow alternate location for .sourceinstall
Date: Sun, 06 Dec 2009 17:03:17 +0100
User-agent: Thunderbird 2.0.0.23 (X11/20090812)

Brian Gough wrote:
At Sun, 6 Dec 2009 00:30:46 +0100,
Claudio Fontana wrote:
On Sat, Dec 5, 2009 at 11:21 PM, Brian Gough <address@hidden> wrote:
I think it could be useful to allow the user to set an alternative
location for the .sourceinstall directory.  The patch below gives
the environment variable SOURCEINSTALL priority over HOME if it is
set, otherwise the behavior is the same.
I normally just symlink from ~/.sourceinstall. However, if you think
it makes sense to easily switch between directories, I can include
this.

Yes, I'd like to be able to switch between installing in the gnusys
system directory and in my home directory.


I am about to checkin the following change.
I changed the error message a little bit, renamed the variable to
SOURCEINSTALLDIR, and avoided appending .sourceinstall to the
SOURCEINSTALLDIR (so you can specify directly what you want),
while if HOME is used, the .sourceinstall is appended as usual.

Seems ok?

Claudio


Index: srcinst.c
===================================================================
RCS file: /sources/sourceinstall/sourceinstall2/libsrcinst/srcinst.c,v
retrieving revision 1.25
diff -u -r1.25 srcinst.c
--- srcinst.c   6 Dec 2009 15:42:43 -0000       1.25
+++ srcinst.c   6 Dec 2009 15:59:48 -0000
@@ -433,9 +433,18 @@
     memset(_srcinst_state.files, 0, sizeof(char *) * SRCINST_FILE_N);
     memset(_srcinst_state.dirs, 0, sizeof(char *) * SRCINST_DIR_N);
 
-    if (!(h = getenv("HOME"))) {
-       srcinst_warning(SRCINST_ERR_CORE, _("cannot find env variable HOME"),
-                       0);
+    if ((h = getenv("SOURCEINSTALLDIR")) && *h) {
+       /* use SOURCEINSTALLDIR env variable */
+       _srcinst_state.dirs[SRCINST_DIR_CFG] = h;
+
+    } else if ((h = getenv("HOME")) && *h) {
+       /* use HOME env variable, append .sourceinstall */
+       _srcinst_state.dirs[SRCINST_DIR_CFG] =
+           srcinst_fnjoin(h, ".sourceinstall");
+
+    } else {
+       srcinst_warning(SRCINST_ERR_CORE, _("cannot find env variable "
+                                           "SOURCEINSTALLDIR or HOME"), 0);
        return 0;
     }
 
@@ -448,8 +457,6 @@
        _srcinst_state.dirs[SRCINST_DIR_RUN] = srcinst_strdup(buffer);
     }
     _srcinst_state.dirs[SRCINST_DIR_RUNBUILD] = 0;
-    _srcinst_state.dirs[SRCINST_DIR_CFG] =
-       srcinst_fnjoin(h, ".sourceinstall");
     _srcinst_state.dirs[SRCINST_DIR_PACK] =
        srcinst_fnjoin(_srcinst_state.dirs[SRCINST_DIR_CFG], "packages");
     _srcinst_state.dirs[SRCINST_DIR_SRC] =

reply via email to

[Prev in Thread] Current Thread [Next in Thread]