]>
Commit | Line | Data |
---|---|---|
7a7d4f39 JR |
1 | #!/bin/sh |
2 | ||
3 | set -e | |
4 | ||
5 | PREREQ="cryptroot" | |
6 | ||
7 | prereqs() | |
8 | { | |
9 | echo "$PREREQ" | |
10 | } | |
11 | ||
12 | case $1 in | |
13 | prereqs) | |
14 | prereqs | |
15 | exit 0 | |
16 | ;; | |
17 | esac | |
18 | ||
19 | . /usr/share/initramfs-tools/hook-functions | |
20 | ||
21 | # Hooks for loading smartcard reading software into the initramfs | |
22 | ||
23 | # Check whether cryptroot hook has installed decrypt_opensc script | |
24 | if [ ! -x ${DESTDIR}/keyscripts/decrypt_opensc ] ; then | |
25 | exit 0 | |
26 | fi | |
27 | ||
28 | # Install cryptroot key files into initramfs | |
29 | keys=$(sed 's/^\(.*,\|\)key=//; s/,.*//' ${DESTDIR}/conf/conf.d/cryptroot) | |
30 | ||
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 | |
35 | exit 1 | |
36 | fi | |
37 | for key in ${keys} ; do | |
38 | if [ ! -d ${DESTDIR}/$(dirname ${key}) ] ; then | |
39 | mkdir -p ${DESTDIR}/$(dirname ${key}) | |
40 | fi | |
41 | cp ${key} ${DESTDIR}/${key} | |
42 | done | |
43 | fi | |
44 | ||
45 | # Install directories needed by smartcard reading daemon, command, and | |
46 | # key-script | |
47 | for dir in etc/opensc usr/lib/pcsc var/run tmp ; do | |
48 | if [ ! -d ${DESTDIR}/${dir} ] ; then mkdir -p ${DESTDIR}/${dir} ; fi | |
49 | done | |
50 | ||
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 | |
56 | ||
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 |