summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-01-05 23:40:06 +0100
committerLudovic Courtès <ludo@gnu.org>2014-01-05 23:40:06 +0100
commit590e4154b683b5efc53269b1c493f48e3d862f48 (patch)
tree23ca29283d5e5afcc4dd22a4667b1a61fdec69b5
parent425b0bfc2ed60163d1b3dad5c6361dea511ba596 (diff)
downloadguix-590e4154b683b5efc53269b1c493f48e3d862f48.tar.gz
archive: Make sure $sysconfdir/guix exists.
* guix/pki.scm (ensure-acl): Make sure the directory of %ACL-FILE
  exists.
* guix/scripts/archive.scm (generate-key-pair): Likewise for
  %PUBLIC-KEY-FILE.
-rw-r--r--guix/pki.scm4
-rw-r--r--guix/scripts/archive.scm4
2 files changed, 6 insertions, 2 deletions
diff --git a/guix/pki.scm b/guix/pki.scm
index dc8139fbc9..5e4dbadd35 100644
--- a/guix/pki.scm
+++ b/guix/pki.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -20,6 +20,7 @@
   #:use-module (guix config)
   #:use-module (guix pk-crypto)
   #:use-module ((guix utils) #:select (with-atomic-file-output))
+  #:use-module ((guix build utils) #:select (mkdir-p))
   #:use-module (ice-9 match)
   #:use-module (rnrs io ports)
   #:export (%public-key-file
@@ -82,6 +83,7 @@ element in KEYS must be a canonical sexp with type 'public-key'."
       (let ((public-key (call-with-input-file %public-key-file
                           (compose string->canonical-sexp
                                    get-string-all))))
+        (mkdir-p (dirname %acl-file))
         (with-atomic-file-output %acl-file
           (lambda (port)
             (display (canonical-sexp->string
diff --git a/guix/scripts/archive.scm b/guix/scripts/archive.scm
index 66000435b4..3b778d8151 100644
--- a/guix/scripts/archive.scm
+++ b/guix/scripts/archive.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -19,6 +19,7 @@
 (define-module (guix scripts archive)
   #:use-module (guix config)
   #:use-module (guix utils)
+  #:use-module ((guix build utils) #:select (mkdir-p))
   #:use-module (guix store)
   #:use-module (guix packages)
   #:use-module (guix derivations)
@@ -250,6 +251,7 @@ this may take time...~%"))
     ;; Create the following files as #o400.
     (umask #o266)
 
+    (mkdir-p (dirname %public-key-file))
     (with-atomic-file-output %public-key-file
       (lambda (port)
         (display (canonical-sexp->string public) port)))