[Top][All Lists]
[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, 6 Dec 2009 00:30:46 +0100 |
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.
>
> Index: srcinst.c
> ===================================================================
> RCS file: /sources/sourceinstall/sourceinstall2/libsrcinst/srcinst.c,v
> retrieving revision 1.24
> diff -u -r1.24 srcinst.c
> --- srcinst.c 8 Dec 2007 15:51:29 -0000 1.24
> +++ srcinst.c 5 Dec 2009 22:05:14 -0000
> @@ -433,10 +437,14 @@
> 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);
> - return 0;
> + if (h = getenv("SOURCEINSTALL")) {
> + /* use SOURCEINSTALL environment variable */
> + } else if (h = getenv("HOME")) {
> + /* use HOME environment variable */
> + } else {
> + srcinst_warning(SRCINST_ERR_CORE, _("cannot find env variable HOME"),
> + 0);
> + return 0;
> }
>
> if (!getcwd(buffer, SRCINST_BUFSIZE)) {
>