guix package: Try $LOGNAME in addition to $USER.

Fixes <http://bugs.gnu.org/17946>.

Notoriously, cron jobs may set LOGNAME only and not USER.  See
e.g. crontab(5) under Debian 7 (wheezy).

* guix/scripts/package.scm (%profile-directory)
(guix-package): Also try LOGNAME if USER is unset.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Taylan Ulrich Bayirli/Kammer 2014-07-05 15:36:44 +03:00 committed by Ludovic Courtès
parent 3e39b916b6
commit 6879fe235c
1 changed files with 5 additions and 2 deletions

View File

@ -59,7 +59,8 @@
(define %profile-directory (define %profile-directory
(string-append %state-directory "/profiles/" (string-append %state-directory "/profiles/"
(or (and=> (getenv "USER") (or (and=> (or (getenv "USER")
(getenv "LOGNAME"))
(cut string-append "per-user/" <>)) (cut string-append "per-user/" <>))
"default"))) "default")))
@ -808,7 +809,9 @@ more information.~%"))
%profile-directory) %profile-directory)
(format (current-error-port) (format (current-error-port)
(_ "Please change the owner of `~a' to user ~s.~%") (_ "Please change the owner of `~a' to user ~s.~%")
%profile-directory (or (getenv "USER") (getuid))) %profile-directory (or (getenv "USER")
(getenv "LOGNAME")
(getuid)))
(rtfm)))) (rtfm))))
(define (process-actions opts) (define (process-actions opts)