From a20c275ceb8f156a6f43f2cfe54c0bf59ab1461e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Sun, 3 Mar 2024 14:08:37 +0100 Subject: [PATCH] use :? to early-exit instead of :- and hope for a good error --- initrd/install.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/initrd/install.h b/initrd/install.h index 4d4aaf4..019864c 100644 --- a/initrd/install.h +++ b/initrd/install.h @@ -6,8 +6,8 @@ PREREQ # tcsd exits if it doesn't have tss group and user - grep tss /etc/group >> "${TARGET_DIR:-MUST_EXIST}/etc/group" - grep tss /etc/passwd >> "${TARGET_DIR:-MUST_EXIST}/etc/passwd" + grep tss /etc/group >> "${TARGET_DIR:?must exist}/etc/group" + grep tss /etc/passwd >> "${TARGET_DIR:?must exist}/etc/passwd" for f in /lib/udev/rules.d/*tpm*; do INST_UDEV "$f" @@ -15,13 +15,13 @@ if [ -e /etc/tcsd.conf ]; then INST_CFG /etc/tcsd.conf - chown root:tss "${TARGET_DIR:-MUST_EXIST}/etc/tcsd.conf" + chown root:tss "${TARGET_DIR:?must exist}/etc/tcsd.conf" system_ps_file="$(awk -F '[[:space:]]*=[[:space:]]*' '!/^[[:space:]]*#/ && !/^$/ && $1 ~ /system_ps_file$/ {gsub(/[[:space:]]*$/, "", $2); print $2}' /etc/tcsd.conf)" system_ps_file="${system_ps_file:-/var/lib/tpm/system.data}" fi # tcsd can't find SRK if state not present, refuses to start if it doesn't have parent to tss dir - mkdir -p "${TARGET_DIR:-MUST_EXIST}/$(dirname "$(dirname "$system_ps_file")")" + mkdir -p "${TARGET_DIR:?must exist}/$(dirname "$(dirname "$system_ps_file")")" [ -f "$system_ps_file" ] && INST_STATE "$system_ps_file" }