From: Alex Sassmannshausen <alex.sassmannshausen@gmail.com>
To: guix-devel@gnu.org
Subject: =?y?q?=5BPATCH=201/2=5D=20dmd=3A=20Use=20=7E/=2Edmd=2Ed/=20by=20default=20when=20not=20run=20as=20root=2E?=
Date: Mon, 3 Feb 2014 18:37:44 +0100 [thread overview]
Message-ID: <1391449065-19063-2-git-send-email-alex.sassmannshausen@gmail.com> (raw)
In-Reply-To: <1391449065-19063-1-git-send-email-alex.sassmannshausen@gmail.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=y, Size: 2625 bytes --]
* modules/dmd/support.scm: Add copyright.
(user-dmddir): New variable.
(default-logfile): Use it instead of user-homedir.
(default-persistency-state-file): Use it instead of user-homedir.
(default-configfile): Use it instead of user-homedir, use init.scm
as default name for configfile, ensure .dmd.d exists.
(default-socket-dir): Add check for root, if #f, use user-dmddir as
base for socket.
---
modules/dmd/support.scm | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/modules/dmd/support.scm b/modules/dmd/support.scm
index 413e65b..f9c9989 100644
--- a/modules/dmd/support.scm
+++ b/modules/dmd/support.scm
@@ -1,4 +1,5 @@
-;; support.scm -- Various general support facilities, shared by deco and dmd.
+;; support.scm -- Various support facilities, used by deco and dmd.
+;; Copyright (C) 2014 A.Sassmannshausen <alex.sassmannshausen@gmail.com>
;; Copyright (C) 2013 Ludovic Courtès <ludo@gnu.org>
;; Copyright (C) 2002, 2003 Wolfgang Jährling <wolfgang@pro-linux.de>
;;
@@ -158,21 +159,31 @@ There is NO WARRANTY, to the extent permitted by law.")))
(getenv "HOME")
"/"))
+;; dmd default subdirectory if dmd is run as a normal user.
+(define user-dmddir (string-append user-homedir "/.dmd.d"))
+
;; Logfile.
(define default-logfile
(if (zero? (getuid))
(string-append %localstatedir "/log/dmd.log")
- (string-append user-homedir "/.dmd.log")))
+ (string-append user-dmddir "/dmd.log")))
;; Configuration file.
(define default-config-file
(if (zero? (getuid))
(string-append Prefix-dir "/etc/dmdconf.scm")
- (string-append user-homedir "/.dmdconf.scm")))
+ (begin
+ (let ((config-file (string-append user-dmddir "/init.scm")))
+ (cond ((not (file-exists? user-dmddir))
+ (mkdir user-dmddir)
+ config-file)
+ (else config-file))))))
;; The directory where the socket resides.
(define default-socket-dir
- (string-append %localstatedir "/run/dmd"))
+ (if (zero? (getuid))
+ (string-append %localstatedir "/run/dmd")
+ (string-append user-dmddir "/run")))
;; Unix domain socket for receiving commands in dmd.
(define default-socket-file
@@ -182,7 +193,7 @@ There is NO WARRANTY, to the extent permitted by law.")))
(define default-persistency-state-file
(if (zero? (getuid))
(string-append %localstatedir "/lib/misc/dmd-state")
- (string-append user-homedir "/.dmd-state")))
+ (string-append user-dmddir "/dmd-state")))
;; Global variables set from (dmd).
(define persistency #f)
--
1.7.9.5
next prev parent reply other threads:[~2014-02-03 17:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-03 17:37 dmd: make user-mode easier to use Alex Sassmannshausen
2014-02-03 17:37 ` Alex Sassmannshausen [this message]
2014-02-04 20:34 ` [PATCH 1/2] dmd: Use ~/.dmd.d/ by default when not run as root Ludovic Courtès
2014-02-03 17:37 ` [PATCH 2/2] dmd: Make config file if necessary " Alex Sassmannshausen
2014-02-04 20:41 ` Ludovic Courtès
2014-02-05 18:27 ` Alex Sassmannshausen
2014-02-05 20:17 ` Ludovic Courtès
2014-02-04 20:34 ` dmd: make user-mode easier to use Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1391449065-19063-2-git-send-email-alex.sassmannshausen@gmail.com \
--to=alex.sassmannshausen@gmail.com \
--cc=guix-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.