+make install DESTDIR=${RD}
+
+cd ${wd}
+
+tar xf $(distfile ${gpg})
+
+cd ${gpg}*
+
+LDFLAGS="-static" \
+ ./configure \
+ --prefix=/ \
+ --enable-static_rnd=linux \
+ --disable-gnupg-iconv \
+ --enable-minimal \
+ --disable-agent-support \
+ --disable-photo-viewers \
+ --disable-keyserver-helpers \
+ --disable-dns-srv \
+ --disable-dns-cert \
+ --without-readline \
+ --with-included-zlib \
+ --enable-card-support \
+ --enable-noexecstack
+
+make -j8
+make install DESTDIR=${RD}
+
+
+# Copy all necessary dynamic libraries
+for bin in ${DYN_BIN}; do
+ for lib in $(lddtree -l ${bin}); do
+ DIR=$(dirname ${lib})
+ mkdir -p ${RD}${DIR}
+ cp -L ${lib} ${RD}${lib}
+ done
+done
+
+cat << EOF > ${RD}/init
+#!/bin/busybox sh
+rescue_shell() {
+ /bin/busybox echo "Something went wrong. Dropping you to a shell"
+ /bin/busybox --install -s
+ exec /bin/sh
+}
+
+# Mount filesystems
+/bin/busybox mount -t devtmpfs none /dev || rescue_shell
+/bin/busybox mount -t proc none /proc || rescue_shell
+/bin/busybox mount -t sysfs none /sys || rescue_shell
+#/bin/busybox echo 0 > /proc/sys/kernel/printk || rescue_shell
+
+# Unlock luks device
+/sbin/cryptsetup -T 5 luksOpen /dev/sdb3 lukssdb3 || rescue_shell
+
+# Create LVM nodes /dev/main/root etc
+/sbin/lvm vgscan --mknodes || rescue_shell
+/sbin/lvm lvchange -a ly main/root || rescue_shell
+/sbin/lvm lvchange -a ly main/home || rescue_shell
+/sbin/lvm lvchange -a ly main/swap || rescue_shell
+/sbin/lvm vgscan --mknodes || rescue_shell
+
+# Mount root fs
+/bin/busybox mount -o ro /dev/main/root /mnt/root || rescue_shell
+
+# Unmount filesystems
+/bin/busybox umount /dev || rescue_shell
+
+# Rescue shell for dicking around:
+/bin/busybox install -s
+/bin/sh
+
+# Boot system
+exec /bin/busybox switch_root /mnt/root /sbin/init || rescue_shell
+EOF
+
+chmod +x ${RD}/init
+
+find ${RD} -type f -printf "/%P %p %m 0 0\n" > ${wd}/filelist
+find ${RD} -type d -printf "/%P %m 0 0 \n" >> ${wd}/filelist
+
+pushd /usr/src/linux
+/usr/src/linux/scripts/gen_initramfs_list.sh \
+ -o ${wd}/initramfs.gz -u "squash" -g "squash" ${wd}/filelist
+popd