From debbugs-submit-bounces@debbugs.gnu.org Tue Dec 20 10:03:42 2022 Received: (at 59845) by debbugs.gnu.org; 20 Dec 2022 15:03:42 +0000 Received: from localhost ([127.0.0.1]:45356 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7e9e-0005YW-7G for submit@debbugs.gnu.org; Tue, 20 Dec 2022 10:03:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47566) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7e9d-0005YO-EW for 59845@debbugs.gnu.org; Tue, 20 Dec 2022 10:03:41 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7e9P-0005kk-LQ; Tue, 20 Dec 2022 10:03:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=Ob4+M/dWbVo58HQCuFcTyyj7zFjUTJnWPtfPYidxWsg=; b=AtSMMTKgUYAL8PRgGaTB wuxaJkT4eqbznBAPVfvmeYvW801p4CK7WvM65m9FrhbZKZ60Zn0Ds8QVW9QTNECJnc6sK9nUG8Ra7 Ndl7SeamAGcuGU+cB7UzeEU47s67xVvDa9ZNIkGEfdRYcSI55di6bSVBjO5e0Oabjas27vCe1dNBc RPIGrB0p0EZiU6nARVoC/bv1zKB/jy5Av9hj5UXqHbbyP1NtNtx7LP/jYz+IuvHhTadbnyH+ts4pn CYRFs9Wj+p1PIp9LhpxFldXPif6GmJDhCBRYJeCmm788M5AVq6FRBaES2s+Sb8z8EXU6MxnYarA9C 79IY2hXjcs5MCQ==; Received: from [193.50.110.60] (helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7e9O-00036b-Fc; Tue, 20 Dec 2022 10:03:27 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Yarl Baudig Subject: Re: bug#59845: [PATCH 0/4] Add PMB (Integrated Library System) References: <20221209115349.5821-1-yarl-baudig@mailoo.org> <20221209115349.5821-3-yarl-baudig@mailoo.org> Date: Tue, 20 Dec 2022 16:03:24 +0100 In-Reply-To: <20221209115349.5821-3-yarl-baudig@mailoo.org> (Yarl Baudig's message of "Fri, 9 Dec 2022 12:53:48 +0100") Message-ID: <87359a6rsz.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 59845 Cc: 59845@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Yarl Baudig 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=E2=80=99s best to avoid doing too much w= ork 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-dire= ctory) This can be simplified along these lines: (for-each lchown (find-files #$http-directory #:directories? #t)) But again, that=E2=80=99s a lot of I/O. > + ;; Those are to hide installation files on a re-activation > + (if > + (file-exists? (string-append #$http-directory "/tables/noinstal= l.php")) > + (delete-file (string-append #$http-directory "/tables/install.p= hp"))) > + (if > + (file-exists? (string-append #$http-directory "/tables/noinstal= l_rep.php")) > + (delete-file (string-append #$http-directory "/tables/install_r= ep.php")))))) Or just: (false-if-exception (delete-file =E2=80=A6)) > +(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 =E2=80=98nginx-service-type=E2=80=99 with =E2=80=98%defaul= t-pmb-location=E2=80=99? Likewise, it looks like it=E2=80=99d be nice to extend =E2=80=98mysql-servi= ce-type=E2=80=99 with the extra config. That=E2=80=99s 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.