me
/
guix
Archived
1
0
Fork 0

services: slim: Allow non-absolute path to be used as session command.

* gnu/services/xorg.scm (xinitrc)[builder]: Don't check the existence
  of COMMAND.  Only run ~/.xsession when it exists.
master
宋文武 2015-03-08 20:57:53 +08:00
parent 4bd43bbe73
commit e0b85670cf
1 changed files with 18 additions and 18 deletions

View File

@ -158,9 +158,7 @@ which should be passed to this script as the first argument. If not, the
;; environment variables that one gets when logging in on a tty, for ;; environment variables that one gets when logging in on a tty, for
;; instance. ;; instance.
(let* ((pw (getpw (getuid))) (let* ((pw (getpw (getuid)))
(shell (passwd:shell pw)) (shell (passwd:shell pw)))
(st (stat command #f)))
(when (and st (not (zero? (logand (stat:mode st) #o100))))
;; Close any open file descriptors. This is all the more ;; Close any open file descriptors. This is all the more
;; important that SLiM itself exec's us directly without closing ;; important that SLiM itself exec's us directly without closing
;; its own file descriptors! ;; its own file descriptors!
@ -168,16 +166,18 @@ which should be passed to this script as the first argument. If not, the
;; The '--login' option is supported at least by Bash and zsh. ;; The '--login' option is supported at least by Bash and zsh.
(execl shell shell "--login" "-c" (execl shell shell "--login" "-c"
(string-join (cons command args)))))) (string-join (cons command args)))))
(let ((home (getenv "HOME")) (let* ((home (getenv "HOME"))
(xsession-file (string-append home "/.xsession"))
(session (match (command-line) (session (match (command-line)
((_ x) x) ((_ x) x)
(_ #$fallback-session)))) (_ #$fallback-session))))
;; First, try to run ~/.xsession. (if (file-exists? xsession-file)
(exec-from-login-shell (string-append home "/.xsession")) ;; Run ~/.xsession when it exists.
;; Then try to start the specified session. (exec-from-login-shell xsession-file)
(exec-from-login-shell session)))) ;; Otherwise, start the specified session.
(exec-from-login-shell session)))))
(gexp->script "xinitrc" builder)) (gexp->script "xinitrc" builder))