summaryrefslogtreecommitdiffstats
path: root/modules.d/01systemd-pcrphase/module-setup.sh
diff options
context:
space:
mode:
Diffstat (limited to 'modules.d/01systemd-pcrphase/module-setup.sh')
-rwxr-xr-xmodules.d/01systemd-pcrphase/module-setup.sh23
1 files changed, 16 insertions, 7 deletions
diff --git a/modules.d/01systemd-pcrphase/module-setup.sh b/modules.d/01systemd-pcrphase/module-setup.sh
index eb85207..3016d7e 100755
--- a/modules.d/01systemd-pcrphase/module-setup.sh
+++ b/modules.d/01systemd-pcrphase/module-setup.sh
@@ -4,7 +4,6 @@
# Prerequisite check(s) for module.
check() {
-
# If the binary(s) requirements are not fulfilled the module can't be installed.
# systemd-255 renamed the binary, check for old and new location.
if ! require_binaries "$systemdutildir"/systemd-pcrphase \
@@ -12,23 +11,34 @@ check() {
return 1
fi
- return 0
+ if [[ $hostonly ]]; then
+ return 255
+ fi
+ return 0
}
# Module dependency requirements.
depends() {
-
# This module has external dependency on other module(s).
- echo systemd tpm2-tss
+
+ local deps
+ deps="systemd"
+
+ # optional dependencies
+ module="tpm2-tss"
+ module_check $module > /dev/null 2>&1
+ if [[ $? == 255 ]]; then
+ deps+=" $module"
+ fi
+ echo "$deps"
+
# Return 0 to include the dependent module(s) in the initramfs.
return 0
-
}
# Install the required file(s) and directories for the module in the initramfs.
install() {
-
inst_multiple -o \
"$systemdutildir"/systemd-pcrphase \
"$systemdutildir"/systemd-pcrextend \
@@ -43,5 +53,4 @@ install() {
"$systemdsystemconfdir/systemd-pcrphase-initrd.service.d/*.conf" \
"$systemdsystemconfdir"/initrd.target.wants/systemd-pcrphase-initrd.service
fi
-
}