summaryrefslogtreecommitdiffstats
path: root/usr/share/initramfs-tools/hooks/cryptlukssc
blob: 577fc96174535b144f148a26fffaf23fb0aeb74f (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
#!/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/pcsc 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
if [ -e /lib/*`uname -i`*/libgcc_s.so.1 ]
then
  copy_exec /lib/*`uname -i`*/libgcc_s.so.1 /lib
else
  copy_exec /lib/libgcc_s.so.1 /lib
fi
if [ -e /lib/*`uname -i`*/libpcsclite.so.1 ]
then
  copy_exec /lib/*`uname -i`*/libpcsclite.so.1 /lib
else
  copy_exec /lib/libpcsclite.so.1 /lib
fi
if [ -e /usr/lib/*`uname -i`*/libusb-1.0.so.0 ]
then
  copy_exec /usr/lib/*`uname -i`*/libusb-1.0.so.0 /usr/lib
else if [ -e /usr/lib/libusb-1.0.so.0 ]
then
  copy_exec /usr/lib/libusb-1.0.so.0 /usr/lib
fi
cp -r /usr/lib/pcsc ${DESTDIR}/usr/lib
if [ -e /etc/reader.conf.d ]
then
  cp -Rp /etc/reader.conf.d ${DESTDIR}/etc/
else
  cp /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
cp /etc/opensc/opensc.conf ${DESTDIR}/etc/opensc

# 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/scriptor_standalone /bin
copy_exec /usr/bin/smartauth.sh /bin

# Libraries
# cp /usr/lib/libltdl.so* ${DESTDIR}/usr/lib
# cp /lib/libncurses.so.5 ${DESTDIR}/lib
if [ -e /lib/*`uname -i`*/libncursesw.so.5 ]
then
  cp /lib/*`uname -i`*/libncursesw.so.5 ${DESTDIR}/lib
else
  cp /lib/libncursesw.so.5 ${DESTDIR}/lib
fi