|
| 1 | +#!/bin/bash |
| 2 | +# This file is part of dracut. |
| 3 | +# SPDX-License-Identifier: GPL-2.0-or-later |
| 4 | + |
| 5 | +# Prerequisite check(s) for module. |
| 6 | +check() { |
| 7 | + |
| 8 | + # If the binary(s) requirements are not fulfilled the module can't be installed. |
| 9 | + require_binaries \ |
| 10 | + "$systemdutildir"/systemd-veritysetup \ |
| 11 | + "$systemdutildir"/system-generators/systemd-veritysetup-generator \ |
| 12 | + || return 1 |
| 13 | + |
| 14 | + # Return 255 to only include the module, if another module requires it. |
| 15 | + return 255 |
| 16 | + |
| 17 | +} |
| 18 | + |
| 19 | +# Module dependency requirements. |
| 20 | +depends() { |
| 21 | + |
| 22 | + # This module has external dependency on other module(s). |
| 23 | + echo systemd dm |
| 24 | + # Return 0 to include the dependent module(s) in the initramfs. |
| 25 | + return 0 |
| 26 | + |
| 27 | +} |
| 28 | + |
| 29 | +# Install the required file(s) and directories for the module in the initramfs. |
| 30 | +install() { |
| 31 | + |
| 32 | + inst_multiple -o \ |
| 33 | + "$systemdutildir"/systemd-veritysetup \ |
| 34 | + "$systemdutildir"/system-generators/systemd-veritysetup-generator \ |
| 35 | + "$systemdsystemunitdir"/remote-veritysetup.target \ |
| 36 | + "$systemdsystemunitdir"/veritysetup-pre.target \ |
| 37 | + "$systemdsystemunitdir"/veritysetup.target \ |
| 38 | + "$systemdsystemunitdir"/sysinit.target.wants/veritysetup.target \ |
| 39 | + "$systemdsystemunitdir"/initrd-root-device.target.wants/remote-veritysetup.target |
| 40 | + |
| 41 | + # Install the hosts local user configurations if enabled. |
| 42 | + if [[ $hostonly ]]; then |
| 43 | + inst_multiple -H -o \ |
| 44 | + /etc/veritytab \ |
| 45 | + "$systemdsystemconfdir"/veritysetup.target \ |
| 46 | + "$systemdsystemconfdir/veritysetup.target.wants/*.target" \ |
| 47 | + "$systemdsystemconfdir"/veritysetup-pre.target \ |
| 48 | + "$systemdsystemconfdir/veritysetup-pre.target.wants/*.target" \ |
| 49 | + "$systemdsystemconfdir"/remote-veritysetup.target \ |
| 50 | + "$systemdsystemconfdir/remote-veritysetup.target.wants/*.target" \ |
| 51 | + "$systemdsystemconfdir"/sysinit.target.wants/veritysetup.target \ |
| 52 | + "$systemdsystemconfdir/sysinit.target.wants/veritysetup.target.wants/*.target" \ |
| 53 | + "$systemdsystemconfdir"/initrd-root-device.target.wants/remote-cryptsetup.target |
| 54 | + fi |
| 55 | + |
| 56 | + # Install required libraries. |
| 57 | + _arch=${DRACUT_ARCH:-$(uname -m)} |
| 58 | + inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libcryptsetup.so.*" |
| 59 | + |
| 60 | +} |
0 commit comments