Merge pull request #1031 from avar/add-mu_home-env-variable

Add support for specifying --muhome via MU_HOME in the environment
This commit is contained in:
Dirk-Jan C. Binnema 2017-03-05 15:52:30 +02:00 committed by GitHub
commit d4b0b1c3b5
5 changed files with 20 additions and 5 deletions

View File

@ -16,6 +16,9 @@
- prefer gpg2 for crypto
- fix a crash when running on OpenBSD
- fix --clear-links (broken filenames)
- You can now set the MU_HOME environment variable as an
alternative way of setting the mu homedir via the --muhome
commadn-line parameter.
*** mu4e

View File

@ -199,9 +199,16 @@ gchar*
mu_util_guess_mu_homedir (void)
{
const char* home;
const gchar *hdir1;
/* g_get_home_dir use /etc/passwd, not $HOME; this is better,
* as HOME may be wrong when using 'sudo' etc.*/
/* first, try MU_HOME */
hdir1 = g_getenv ("MU_HOME");
if (hdir1 && mu_util_check_dir (hdir1, TRUE, FALSE))
return g_strdup (hdir1);
/* then, g_get_home_dir use /etc/passwd, not $HOME; this is
* better, as HOME may be wrong when using 'sudo' etc.*/
home = g_get_home_dir ();
if (!home) {

View File

@ -62,7 +62,8 @@ char* mu_util_guess_maildir (void)
/**
* guess the place of the mu homedir (typically, ~/.mu). Note, this
* guess the place of the mu homedir; first try $MU_HOME; if it is
* unset or non-existant, try ~/.mu. Note, the fallback ~/.mu
* directory does not necessarily exist. mu_util_check_dir can be used
* to check that
*

View File

@ -152,7 +152,9 @@ including \fBmu\fR without any command.
.TP
\fB\-\-muhome\fR
causes \fBmu\fR to use an alternative directory to
store and read its database and logs. By default, \fI~/.mu\fR is used.
store and read its database and logs. By default, \fBmu\fR uses
whatever the \fBMU_HOME\fR environment variable is set to; if it is
not set, \fI~/.mu\fR is used.
.TP
\fB\-d\fR, \fB\-\-debug\fR

View File

@ -23,7 +23,9 @@ toolbar.
.TP
\fB\-\-muhome\fR causes \fBmug\fR to use an alternative directory to read its
database and bookmarks and write its logs. By default, \fI~/.mu\fR is used.
database and bookmarks and write its logs. By default, \fBmug\fR uses
whatever the \fBMU_HOME\fR environment variable is set to; if it is
not set, \fI~/.mu\fR is used.
.SH BUGS
Please report bugs if you find them: