19 . /usr/share/initramfs-tools/hook-functions
21 # Hooks for loading smartcard reading software into the initramfs
23 # Check whether cryptroot hook has installed decrypt_opensc script
24 if [ ! -x ${DESTDIR}/keyscripts/decrypt_opensc ] ; then
28 # Install cryptroot key files into initramfs
29 keys=$(sed 's/^\(.*,\|\)key=//; s/,.*//' ${DESTDIR}/conf/conf.d/cryptroot)
31 if [ "${keys}" != "none" ]; then
32 if [ -z "${keys}" ]; then
33 echo $0: Missing key files in ${DESTDIR}/conf/conf.d/cryptroot >&2
34 cat ${DESTDIR}/conf/conf.d/cryptroot >&2
37 for key in ${keys} ; do
38 if [ ! -d ${DESTDIR}/$(dirname ${key}) ] ; then
39 mkdir -p ${DESTDIR}/$(dirname ${key})
41 cp ${key} ${DESTDIR}/${key}
45 # Install directories needed by smartcard reading daemon, command, and
47 for dir in etc/opensc usr/lib/pcsc var/run tmp ; do
48 if [ ! -d ${DESTDIR}/${dir} ] ; then mkdir -p ${DESTDIR}/${dir} ; fi
51 # Install pcscd daemon, drivers, conf file, and include libgcc as well since
52 # pcscd utilizes pthread_cancel
53 copy_exec /usr/sbin/pcscd
54 cp -r /usr/lib/pcsc ${DESTDIR}/usr/lib
55 cp /etc/reader.conf ${DESTDIR}/etc
57 # Install opensc commands and conf file
58 copy_exec /usr/bin/opensc-tool
59 copy_exec /usr/bin/pkcs15-crypt
60 cp /etc/opensc/opensc.conf ${DESTDIR}/etc/opensc