guix/gnu/packages/patches/dmd-getpw.patch
Ludovic Courtès 9b0ac80258 gnu: Populate /etc upon startup.
* gnu/packages/patches/dmd-getpw.patch: New file.
* gnu-system.am (dist_patch_DATA): Add it.
* gnu/packages/system.scm (dmd): Use it.
* gnu/system/vm.scm (system-qemu-image): Don't explicitly populate /etc;
  don't add ETC to the GC roots.
* gnu/system/dmd.scm (dmd-configuration-file): Add 'etc' parameter.
  [config]: Populate /etc from there.
2013-12-08 22:43:56 +01:00

20 lines
591 B
Diff
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

When bootstrapping and running as PID 1, /etc/{passwd,shadow} may be unavailable.
Gracefully handle that.
diff --git a/modules/dmd/support.scm b/modules/dmd/support.scm
index 9b592c5..602e409 100644
--- a/modules/dmd/support.scm
+++ b/modules/dmd/support.scm
@@ -151,7 +151,10 @@ There is NO WARRANTY, to the extent permitted by law.")))
;; Home directory of the user.
-(define user-homedir (passwd:dir (getpwuid (getuid))))
+(define user-homedir
+ (or (false-if-exception (passwd:dir (getpwuid (getuid))))
+ (getenv "HOME")
+ "/"))
;; Logfile.
(define default-logfile