|
|
|
#!/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
|