|
| 1 | +#!/bin/bash |
| 2 | +# This file is part of dracut. |
| 3 | +# SPDX-License-Identifier: GPL-2.0-or-later |
| 4 | + |
| 5 | +# Prerequisite check(s) for module. |
| 6 | +check() { |
| 7 | + |
| 8 | + # If the binary(s) requirements are not fulfilled the module can't be installed. |
| 9 | + require_binaries pcscd || return 1 |
| 10 | + |
| 11 | + # Return 255 to only include the module, if another module requires it. |
| 12 | + return 255 |
| 13 | + |
| 14 | +} |
| 15 | + |
| 16 | +# Module dependency requirements. |
| 17 | +depends() { |
| 18 | + |
| 19 | + # This module has external dependency on other module(s). |
| 20 | + echo systemd-udevd |
| 21 | + # Return 0 to include the dependent module(s) in the initramfs. |
| 22 | + return 0 |
| 23 | + |
| 24 | +} |
| 25 | + |
| 26 | +# Install the required file(s) and directories for the module in the initramfs. |
| 27 | +install() { |
| 28 | + inst_simple "$moddir/pcscd.service" "${systemdsystemunitdir}"/pcscd.service |
| 29 | + inst_simple "$moddir/pcscd.socket" "${systemdsystemunitdir}"/pcscd.socket |
| 30 | + |
| 31 | + inst_multiple -o \ |
| 32 | + pcscd |
| 33 | + |
| 34 | + # Enable systemd type unit(s) |
| 35 | + for i in \ |
| 36 | + pcscd.service \ |
| 37 | + pcscd.socket; do |
| 38 | + $SYSTEMCTL -q --root "$initdir" enable "$i" |
| 39 | + done |
| 40 | + |
| 41 | + # Install library file(s) |
| 42 | + _arch=${DRACUT_ARCH:-$(uname -m)} |
| 43 | + inst_libdir_file \ |
| 44 | + {"tls/$_arch/",tls/,"$_arch/",}"libopensc.so.*" \ |
| 45 | + {"tls/$_arch/",tls/,"$_arch/",}"libsmm-local.so.*" \ |
| 46 | + {"tls/$_arch/",tls/,"$_arch/",}"opensc-pkcs11.so" \ |
| 47 | + {"tls/$_arch/",tls/,"$_arch/",}"onepin-opensc-pkcs11.so" \ |
| 48 | + {"tls/$_arch/",tls/,"$_arch/",}"pkcs11/opensc-pkcs11.so" \ |
| 49 | + {"tls/$_arch/",tls/,"$_arch/",}"pkcs11/onepin-opensc-pkcs11.so" \ |
| 50 | + {"tls/$_arch/",tls/,"$_arch/",}"pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist" \ |
| 51 | + {"tls/$_arch/",tls/,"$_arch/",}"pcsc/drivers/ifd-ccid.bundle/Contents/Linux/libccid.so" \ |
| 52 | + {"tls/$_arch/",tls/,"$_arch/",}"pcsc/drivers/serial/libccidtwin.so" \ |
| 53 | + {"tls/$_arch/",tls/,"$_arch/",}"libpcsclite.so.*" |
| 54 | + |
| 55 | + # Install the hosts local user configurations if enabled. |
| 56 | + if [[ $hostonly ]]; then |
| 57 | + inst_multiple -H -o \ |
| 58 | + /etc/opensc.conf \ |
| 59 | + "/etc/reader.conf.d/*" |
| 60 | + fi |
| 61 | + |
| 62 | +} |
0 commit comments