blob: b44b5e13af9f127d36776e69068e72d2970110fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
#!/bin/sh
set -e
PREREQ="cryptroot"
prereqs()
{
echo "$PREREQ"
}
case $1 in
prereqs)
prereqs
exit 0
;;
esac
. /usr/share/initramfs-tools/hook-functions
# Hooks for loading smartcard reading software into the initramfs
# Install directories needed by smartcard reading daemon, command, and
# key-script
for dir in etc/opensc usr/lib var/run tmp ; do
if [ ! -d ${DESTDIR}/${dir} ] ;
then
mkdir -p ${DESTDIR}/${dir}
fi
done
# Install pcscd daemon, drivers, conf file, and include libgcc as well since
# pcscd utilizes pthread_cancel
mkdir -p ${DESTDIR}/lib
copy_exec /usr/sbin/pcscd /sbin
ARCHDIR=$(uname -i)
if [ "$ARCHDIR" = "unknown" ]; then
ARCHDIR=$(uname -m)
fi
if [ "$ARCHDIR" = "ppc64le" ]; then
ARCHDIR="powerpc64"
fi
if [ "$ARCHDIR" = "ppc64el" ]; then
ARCHDIR="powerpc64"
fi
if [ -e /lib/*${ARCHDIR}*/libgcc_s.so.1 ]
then
cp -L /lib/*${ARCHDIR}*/libgcc_s.so.1 ${DESTDIR}/lib
else
cp -L /lib/libgcc_s.so.1 ${DESTDIR}/lib
fi
if [ -e /lib/*${ARCHDIR}*/libpcsclite.so.1 ]
then
cp -L /lib/*${ARCHDIR}*/libpcsclite.so.1 ${DESTDIR}/lib
elif [ -e /usr/lib/*${ARCHDIR}*/libpcsclite.so.1 ]
then
cp -L /usr/lib/*${ARCHDIR}*/libpcsclite.so.1 ${DESTDIR}/lib
else
cp -L /lib/libpcsclite.so.1 ${DESTDIR}/lib
fi
if [ -e /usr/lib/*${ARCHDIR}*/libusb-1.0.so.0 ]
then
cp -L /usr/lib/*${ARCHDIR}*/libusb-1.0.so.0 ${DESTDIR}/usr/lib
elif [ -e /lib/*${ARCHDIR}*/libusb-1.0.so.0 ]
then
cp -L /lib/*${ARCHDIR}*/libusb-1.0.so.0 ${DESTDIR}/usr/lib
elif [ -e /usr/lib/libusb-1.0.so.0 ]
then
cp -L /usr/lib/libusb-1.0.so.0 ${DESTDIR}/usr/lib
else
echo "Unable to locate libusb-1.0"
exit 1
fi
cp -LRp /usr/lib/pcsc ${DESTDIR}/usr/lib/
if [ -e /etc/reader.conf.d ]
then
cp -L -Rp /etc/reader.conf.d ${DESTDIR}/etc/
else
cp -L /etc/reader.conf ${DESTDIR}/etc/
fi
# Install opensc commands and conf file
copy_exec /usr/bin/opensc-tool /bin/
copy_exec /usr/bin/pkcs15-crypt /bin/
copy_exec /usr/bin/pkcs15-tool /bin/
cp -L /etc/opensc/opensc.conf ${DESTDIR}/etc/opensc/
# Install opensc interface library
if [ -e /usr/lib/*${ARCHDIR}*/opensc-pkcs11.so ]
then
cp -L /usr/lib/*${ARCHDIR}*/opensc-pkcs11.so ${DESTDIR}/usr/lib
elif [ -e /usr/lib/opensc-pkcs11.so ]
then
cp -L /usr/lib/opensc-pkcs11.so ${DESTDIR}/usr/lib
fi
# Install other required utilities
copy_exec /bin/grep /bin
copy_exec /bin/mv /bin
copy_exec /bin/cat /bin
copy_exec /bin/sleep /bin
copy_exec /usr/bin/opensc-explorer /bin
copy_exec /usr/bin/openssl /bin
copy_exec /usr/bin/perl /bin
copy_exec /bin/rm /bin
copy_exec /usr/bin/xxd /bin
copy_exec /usr/bin/killall /bin
copy_exec /bin/sed /bin
copy_exec /usr/bin/tr /bin
copy_exec /bin/bash /bin
# Main scripts
copy_exec /usr/bin/cryptosmartcard.sh /bin
copy_exec /usr/bin/cardpincheck /bin
# Libraries
# cp -L /usr/lib/libltdl.so* ${DESTDIR}/usr/lib
# cp -L /lib/libncurses.so.5 ${DESTDIR}/lib
if [ -e /lib/*${ARCHDIR}*/libncursesw.so.[0-9] ]
then
cp -L /lib/*${ARCHDIR}*/libncursesw.so.[0-9] ${DESTDIR}/lib
else
cp -L /lib/libncursesw.so.[0-9] ${DESTDIR}/lib
fi
# LUKS keys
if [ -e /etc/trinity/luks/card ]
then
cp -LRp /etc/trinity/luks/card ${DESTDIR}/tde_luks_keys
else
mkdir -p ${DESTDIR}/tde_luks_keys
fi
exit 0
|