|
| 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 "$systemdutildir"/systemd-pcrphase || return 1 |
| 10 | + |
| 11 | + # Return 255 to only include the module, if another module requires it. |
| 12 | + return 255 |
| 13 | + |
| 14 | +} |
| 15 | + |
| 16 | +# Module dependency requirements. |
| 17 | +depends() { |
| 18 | + |
| 19 | + # This module has external dependency on other module(s). |
| 20 | + echo systemd tpm2-tss |
| 21 | + # Return 0 to include the dependent module(s) in the initramfs. |
| 22 | + return 0 |
| 23 | + |
| 24 | +} |
| 25 | + |
| 26 | +# Install the required file(s) and directories for the module in the initramfs. |
| 27 | +install() { |
| 28 | + |
| 29 | + inst_multiple -o \ |
| 30 | + "$systemdutildir"/systemd-pcrphase \ |
| 31 | + "$systemdsystemunitdir"/systemd-pcrphase.service \ |
| 32 | + "$systemdsystemunitdir/systemd-pcrphase.service.d/*.conf" \ |
| 33 | + "$systemdsystemunitdir"/systemd-pcrphase-sysinit.service \ |
| 34 | + "$systemdsystemunitdir/systemd-pcrphase-sysinit.service/*.conf" \ |
| 35 | + "$systemdsystemunitdir"/systemd-pcrphase-initrd.service \ |
| 36 | + "$systemdsystemunitdir/systemd-pcrphase-initrd.service.d/*.conf" \ |
| 37 | + "$systemdsystemunitdir"/initrd.target.wants/systemd-pcrphase-initrd.service |
| 38 | + |
| 39 | + # Install the hosts local user configurations if enabled. |
| 40 | + if [[ $hostonly ]]; then |
| 41 | + inst_multiple -H -o \ |
| 42 | + "$systemdsystemconfdir"/systemd-pcrphase.service \ |
| 43 | + "$systemdsystemconfdir/systemd-pcrphase.service.d/*.conf" \ |
| 44 | + "$systemdsystemconfdir"/systemd-pcrphase-sysinit.service \ |
| 45 | + "$systemdsystemconfdir/systemd-pcrphase-sysinit.service.d/*.conf" \ |
| 46 | + "$systemdsystemconfdir"/systemd-pcrphase-initrd.service \ |
| 47 | + "$systemdsystemconfdir/systemd-pcrphase-initrd.service.d/*.conf" \ |
| 48 | + "$systemdsystemconfdir"/initrd.target.wants/systemd-pcrphase-initrd.service |
| 49 | + fi |
| 50 | + |
| 51 | +} |
0 commit comments