}
+#------------------------------------------------------------------------------
+add_zfs() {
+
+ local debian_version="wheezy"
+ local debv_file="${TGT_DIR}/etc/debian_version"
+ if [[ -f "${debv_file}" ]] ; then
+ if cat "${debv_file}" | egrep -i "^(stretch|9)" >/dev/null ; then
+ debian_version="stretch"
+ elif cat "${debv_file}" | egrep -i "^(jessie|8)" >/dev/null ; then
+ debian_version="jessie"
+ fi
+ fi
+ if [[ "${debian_version}" != "stretch" ]] ; then
+ warn "Kann ${YELLOW}ZFS-Unterstützung${NORMAL} nicht installieren, nicht unterstützte Debian Version '${YELLOW}${debian_version}${NORMAL}'."
+ return 0
+ fi
+
+ empty_line
+ info "Adding ${GREEN}ZFS${NORMAL} support ..."
+
+ CHROOT apt install --yes debootstrap gdisk linux-headers-amd64 dkms
+
+ local kv=$( CHROOT dpkg-query -l 'linux-headers*' | \
+ grep '^i' | \
+ grep -v linux-headers-amd64 | \
+ grep -- '-amd64 ' | \
+ sort | \
+ tail -n 1 | \
+ awk '{print $2}' | \
+ sed -e 's/^linux-headers-//' )
+
+ info "Kernel-Version im GRM Image: '${GREEN}${kv}${NORMAL}'."
+
+ local spl_version=$( CHROOT apt search spl-dkms 2>/dev/null | grep '^spl-dkms' | awk '{print $2}' )
+ local zfs_version=$( CHROOT apt search zfs-dkms 2>/dev/null | grep '^zfs-dkms' | awk '{print $2}' )
+
+ CHROOT dkms install -m spl -v "${spl_version}" "${kv}"
+ CHROOT dkms install -m zfs -v "${zfs_version}" "${kv}"
+
+# local cmd="apt install --yes"
+# if [[ "${debian_version}" == "jessie" ]] ; then
+# cmd="${cmd} -t jessie-backports"
+# fi
+# cmd="${cmd} zfs-dkms"
+# debug "Führe aus: CHROOT ${cmd}"
+# CHROOT ${cmd}
+
+ sleep 10
+
+}
+
#------------------------------------------------------------------------------
unmounting_dirs() {
update_packages
add_packages
copy_files
+ add_zfs
sleep 2
empty_line