gnu: services: Fix pcscd activation bug.
Fixes: <https://bugs.gnu.org/32478>. * gnu/services/security-token.scm (pcscd-activation): Idempotently create the /var/lib/pcsc symlink so that it does not fail when it already exists.
This commit is contained in:
parent
6d863cdedd
commit
6fb6ac6857
|
@ -20,6 +20,7 @@
|
||||||
#:use-module (gnu services)
|
#:use-module (gnu services)
|
||||||
#:use-module (gnu services shepherd)
|
#:use-module (gnu services shepherd)
|
||||||
#:use-module (gnu packages admin)
|
#:use-module (gnu packages admin)
|
||||||
|
#:use-module (gnu packages base)
|
||||||
#:use-module (gnu packages security-token)
|
#:use-module (gnu packages security-token)
|
||||||
#:use-module (gnu system shadow)
|
#:use-module (gnu system shadow)
|
||||||
#:use-module (guix gexp)
|
#:use-module (guix gexp)
|
||||||
|
@ -62,14 +63,22 @@
|
||||||
(define pcscd-activation
|
(define pcscd-activation
|
||||||
(match-lambda
|
(match-lambda
|
||||||
(($ <pcscd-configuration> pcsc-lite usb-drivers)
|
(($ <pcscd-configuration> pcsc-lite usb-drivers)
|
||||||
#~(begin
|
(with-imported-modules (source-module-closure
|
||||||
(use-modules (guix build utils))
|
'((guix build utils)))
|
||||||
(mkdir-p "/var/lib")
|
#~(begin
|
||||||
(symlink #$(directory-union
|
(use-modules (guix build utils))
|
||||||
"pcsc"
|
;; XXX: We can't use (guix utils) because it requires a
|
||||||
(map (cut file-append <> "/pcsc")
|
;; dynamically-linked Guile, hence the duplicate switch-symlinks.
|
||||||
usb-drivers))
|
(define (switch-symlinks link target)
|
||||||
"/var/lib/pcsc")))))
|
(let ((pivot (string-append link ".new")))
|
||||||
|
(symlink target pivot)
|
||||||
|
(rename-file pivot link)))
|
||||||
|
(mkdir-p "/var/lib")
|
||||||
|
(switch-symlinks "/var/lib/pcsc"
|
||||||
|
#$(directory-union
|
||||||
|
"pcsc"
|
||||||
|
(map (cut file-append <> "/pcsc")
|
||||||
|
usb-drivers))))))))
|
||||||
|
|
||||||
(define pcscd-service-type
|
(define pcscd-service-type
|
||||||
(service-type
|
(service-type
|
||||||
|
|
Loading…
Reference in New Issue