guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What is wrong with these few lines of guile code?


From: Mike
Subject: Re: What is wrong with these few lines of guile code?
Date: Tue, 31 Oct 2017 10:02:28 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0

On 10/31/2017 09:41 AM, Hartmut Goebel wrote:
Hallo,

i replaced the code of gnu/system/install.scm(make-cow-store target) [1]
with the code below. Now when running this code (which is triggered by
"herd start cow-store /mnt" in the installation-os)|I get this error:
|

herd: exception caught while executing 'start' on service 'cow-store':
ERROR: Unbound variable: gexp

What is wrong with this code? (Parentheses are matching, of course :-)
I'm a Scheme novice, but is your use of 'target' instead of '#$target' further down the definition body a problem?  Or is that a proper use of Guile macros?

-Mike

[1]
https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/system/install.scm#n70

(define (make-cow-store target)
   "Return a gexp that makes the store copy-on-write, using TARGET as the
backing store.  This is useful when TARGET is on a hard disk, whereas the
current store is on a RAM disk."

   (define (set-store-permissions directory)
     ;; Set the right perms on DIRECTORY to use it as the store.
     #~(begin
         (chown #$directory 0 30000)             ;use the fixed
'guixbuild' GID
         (chmod #$directory #o1775)))

   #~(begin
       ;; Bind-mount TARGET's /tmp in case we need space to build things.
       (let ((tmpdir (string-append #$target "/tmp")))
         (mkdir-p tmpdir)
         (mount tmpdir "/tmp" "none" MS_BIND))

       (let* ((rw-dir (string-append target #$%backing-directory))
              ;; FIXME: calculate work-dir from backing-directory:
              ;; normpath(backing-directory + "../.overlayfs-workdir")
              (work-dir (string-append target "/tmp/.overlayfs-workdir")))
         (mkdir-p rw-dir)
         (mkdir-p work-dir)
         (mkdir-p "/.rw-store")
         #$(set-store-permissions #~rw-dir)
         #$(set-store-permissions "/.rw-store")

         ;; Mount the overlay, then atomically make it the store.
         (mount "none" "/.rw-store" "overlay"
                (string-append "lowerdir=" #$(%store-prefix)
                               "upperdir=" #~rw-dir ","
                               "workdir=" #~work-dir))
         (mount "/.rw-store" #$(%store-prefix) "" MS_MOVE)
         (rmdir "/.rw-store"))))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]