#!/bin/sh

# Installs userspace tools and helper packages in the target system.
#

. /lib/partman/lib/base.sh

if grep -q " device-mapper$" /proc/misc; then
    # We can't check the root node directly because root could be
    # on an LVM LV on top of an encrypted device
    if type dmsetup >/dev/null 2>&1 && \
	   dmsetup table | cut -d' ' -f4 | grep -q "crypt" 2>/dev/null; then
		apt-install cryptsetup-initramfs || true
	fi
fi

if type zkey >/dev/null 2>&1 && zkey list | grep -q key; then
	apt-install s390-tools-zkey || true
	mkdir -p /target/etc/zkey/repository
	cp /etc/zkey/repository/* /target/etc/zkey/repository
fi
