GNU bug report logs -
#59845
[PATCH 0/4] Add PMB (Integrated Library System)
Previous Next
Full log
View this message in rfc822 format
Yarl Baudig <yarl-baudig <at> mailoo.org> skribis:
> * gnu/services/ils.scm: New file.
> * gnu/local.mk: Add it.
[...]
> + #~(begin
> + (use-modules (guix build utils))
> + (use-modules (ice-9 ftw))
> + (format #t "Copying pmb '~a' to http directory '~a'~%"
> + (string-append #$pmb "/share/http/pmb")
> + #$http-directory)
> + (mkdir-p #$http-directory)
> + ;; Please be quiet
> + (call-with-output-file "/dev/null"
> + (lambda (port)
> + (with-output-to-port port
> + (lambda ()
> + (copy-recursively (string-append #$pmb "/share/http/pmb")
> + #$http-directory)))))
Do we really need to copy these files?
Keep in mind that activation snippets run each time you boot the system,
and each time you reconfigure. It’s best to avoid doing too much work
there.
> + (define (enter? name stat result)
> + #t)
> + (define (lchown obj)
> + (let ((user (getpwnam #$php-fpm-user))
> + (group (getgrnam #$php-fpm-group)))
> + (chown obj (passwd:uid user) (group:gid group))))
> + (define (leaf name stat result)
> + (lchown name)
> + result)
> + (define (down name stat result)
> + (lchown name)
> + result)
> + (define (up name stat result) result)
> + (define (skip name stat result) result)
> + (define (error name stat errno result)
> + (warning (G_ "~a: ~a~%")
> + name (strerror errno))
> + result)
> + (file-system-fold enter? leaf down up skip error '() #$http-directory)
This can be simplified along these lines:
(for-each lchown (find-files #$http-directory #:directories? #t))
But again, that’s a lot of I/O.
> + ;; Those are to hide installation files on a re-activation
> + (if
> + (file-exists? (string-append #$http-directory "/tables/noinstall.php"))
> + (delete-file (string-append #$http-directory "/tables/install.php")))
> + (if
> + (file-exists? (string-append #$http-directory "/tables/noinstall_rep.php"))
> + (delete-file (string-append #$http-directory "/tables/install_rep.php"))))))
Or just:
(false-if-exception (delete-file …))
> +(define pmb-service-type
> + (service-type
> + (name 'guix)
> + (extensions
> + (list (service-extension activation-service-type
> + pmb-activation)))
> + (default-value (pmb-configuration))
> + (description "Install the pmb Integrated Library System")))
Should it extend ‘nginx-service-type’ with ‘%default-pmb-location’?
Likewise, it looks like it’d be nice to extend ‘mysql-service-type’ with
the extra config. That’s not currently possible but we should add it.
That way, adding (service pmb-service-type) is all it would take to get
the service up and running.
This bug report was last modified 2 years and 160 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.