#!/bin/sh
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

# initramfs-tools hook: force /etc/crypttab into the initramfs.
# cryptroot normally puts it at /cryptroot/crypttab, but clevis reads
# /etc/crypttab, so copy it there explicitly.
PREREQ=""
prereqs() { echo "$PREREQ"; }
case "$1" in prereqs) prereqs; exit 0 ;; esac

. /usr/share/initramfs-tools/hook-functions

if [ -f /etc/crypttab ]; then
    cp /etc/crypttab "${DESTDIR}/etc/crypttab"
fi
