GPG initramfs append
authordacook <schism@subverted.org>
Thu, 17 Dec 2009 15:58:32 +0000 (08:58 -0700)
committerdacook <schism@subverted.org>
Tue, 11 Jan 2011 19:20:27 +0000 (12:20 -0700)
Add function/handling to actually add the GPG binary to the initramfs

gen_initramfs.sh

index f420a2d3ff45d2f188fd09bad7b7ea9b0e909364..65d849ec6dd64ea53efed3d51460cf755f1533ff 100755 (executable)
@@ -451,6 +451,25 @@ append_firmware() {
        rm -r "${TEMP}/initramfs-firmware-temp/"
 }
 
+append_gpg() {
+       if [ -d "${TEMP}/initramfs-gpg-temp" ]
+       then
+               rm -r "${TEMP}/initramfs-gpg-temp"
+       fi
+       cd ${TEMP}
+       mkdir -p "${TEMP}/initramfs-gpg-temp/sbin/"
+       if [ ! -e ${GPG_BINCACHE} ] ; then
+               print_info 1 '          GPG: Adding support (compiling binaries)...'
+               compile_gpg
+       fi
+       bzip2 -dc "${GPG_BINCACHE}" > "${TEMP}/initramfs-gpg-temp/sbin/gpg" ||
+               gen_die 'Could not extract gpg binary cache!'
+       chmod a+x "${TEMP}/initramfs-gpg-temp/sbin/gpg"
+       cd "${TEMP}/initramfs-gpg-temp/"
+       find . -print | cpio ${CPIO_ARGS} --append -F "${CPIO}"
+       rm -rf "${TEMP}/initramfs-gpg-temp" > /dev/null
+}
+
 print_list()
 {
        local x
@@ -641,6 +660,7 @@ create_initramfs() {
        append_data 'mdadm' "${MDADM}"
        append_data 'luks' "${LUKS}"
        append_data 'multipath' "${MULTIPATH}"
+       append_data 'gpg' "${GPG}"
 
        if [ "${NORAMDISKMODULES}" = '0' ]
        then