From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47306) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1foliL-0003LL-OH for guix-patches@gnu.org; Sun, 12 Aug 2018 04:27:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1foliI-0005Vd-Iq for guix-patches@gnu.org; Sun, 12 Aug 2018 04:27:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:43588) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1foliI-0005VO-Dd for guix-patches@gnu.org; Sun, 12 Aug 2018 04:27:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1foliI-0007g1-4K for guix-patches@gnu.org; Sun, 12 Aug 2018 04:27:02 -0400 Subject: [bug#32358] Add pcscd service Resent-Message-ID: From: Arun Isaac In-Reply-To: <87zhxu7lr9.fsf@gmail.com> References: <87a7q2lqc6.fsf@garuda.local.i-did-not-set--mail-host-address--so-tickle-me> <87zhxu7lr9.fsf@gmail.com> Date: Sun, 12 Aug 2018 13:55:52 +0530 Message-ID: MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Chris Marusich Cc: 32358@debbugs.gnu.org > I'm having a little trouble testing this on my system due to the > following unrelated bug: > > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=28144 > > However, I'll keep trying and let you know once I've tested it out. Sure, no problem. > If you're feeling up to it, it would be great to add a system test, > but it's not necessary, and we could add it later. I'm ok with adding a system test right now. But, what kind of test? Can you elaborate on any ideas you have? > Shouldn't we also export pcscd-configuration-pcsc-lite and > pcscd-configuration-usb-drivers? Sure, will do. >> +(define pcscd-shepherd-service >> + (match-lambda >> + (($ pcsc-lite) >> + (with-imported-modules (source-module-closure >> + '((gnu build shepherd))) >> + (shepherd-service >> + (documentation "PC/SC Smart Card Daemon") >> + (provision '(pcscd)) >> + (modules '((gnu build shepherd))) >> + (start #~(make-forkexec-constructor >> + (list #$(file-append pcsc-lite "/sbin/pcscd") "-f"))) >> + (stop #~(make-kill-destructor))))))) > > Does this work as written? The make-forkexec-constructor and > make-kill-destructor procedures are exported in (shepherd service), but > it doesn't look like that module will be used, since it isn't in the > modules list. If it does work, then I don't understand how (shepherd > service) is getting used, so I'd be curious to know why it works! Yes, the service does work. But, I don't really know why. I copied this bit of code from some other service and modified it incrementally until it did what I wanted. :-P So, I'm not super-clear what exactly is happening here. >> +(define pcscd-activation >> + (match-lambda >> + (($ pcsc-lite usb-drivers) >> + #~(begin >> + (use-modules (guix build utils)) >> + (mkdir-p "/var/lib") >> + (symlink #$(directory-union >> + "pcsc" >> + (map (cut file-append <> "/pcsc") >> + usb-drivers)) >> + "/var/lib/pcsc"))))) > > What happens if the symlink target already exists? Will this crash the > init process, or will the system come online and just report an error? > Some people (such as myself) have already created this directory > manually, so the directory might exist if they forget to delete it. When the symlink already exists, the system reconfigures properly, but reports an error. You will have to delete your existing /var/lib/pcsc symlink before reconfiguring. >> Subject: [PATCH 2/2] gnu: ccid: Move pcsc-lite from inputs to native-inputs. > > Patch 2/2 looks good to me! I pushed this patch alone to master.