From 36a7b2e6ebab5c393f17db1d99fc993475225d6d Mon Sep 17 00:00:00 2001 From: Finn Callies Date: Wed, 6 May 2026 11:57:58 +0200 Subject: [PATCH] pvebc: Minor bash improvements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add minor improvements to the scripts the dracut module calls. Reviewed-by: Holger Dengler Signed-off-by: Finn Callies Signed-off-by: Jan Höppner --- rust/pvebc/95sel-ebc/override-crypttab.sh | 13 +++++++++++++ rust/pvebc/95sel-ebc/pvebc-wrapper.sh | 9 ++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/rust/pvebc/95sel-ebc/override-crypttab.sh b/rust/pvebc/95sel-ebc/override-crypttab.sh index 78b7d79b..ba977bf5 100644 --- a/rust/pvebc/95sel-ebc/override-crypttab.sh +++ b/rust/pvebc/95sel-ebc/override-crypttab.sh @@ -3,7 +3,20 @@ # # Copyright IBM Corp. +set -eu + IBM_RSRC_DIR="/etc/sel-ebc" +block_dev="$(blkid -L cryptroot)" + +if [[ -z "${block_dev}" ]]; then + echo "Unable to find partition with label cryptroot" + exit 1 +elif [[ ! -b "${block_dev}" ]]; then + echo "Unable to find block device ${block_dev}" + exit 1 +else + echo "Found block device ${block_dev}" +fi if [[ ! -f "${IBM_RSRC_DIR}/crypttab" ]]; then echo "Error: source file $IBM_RSRC_DIR/crypttab does not exist" diff --git a/rust/pvebc/95sel-ebc/pvebc-wrapper.sh b/rust/pvebc/95sel-ebc/pvebc-wrapper.sh index 376ee975..107580a2 100644 --- a/rust/pvebc/95sel-ebc/pvebc-wrapper.sh +++ b/rust/pvebc/95sel-ebc/pvebc-wrapper.sh @@ -48,16 +48,23 @@ fi pvebc --toc "$EBC_TMPFS/$TOC" rc=$? if [[ $rc -ne 0 ]]; then + echo "pvebc failed with rc=${rc}" exit $rc fi # Retrieve and check for dummy LUKS passphrase pvsecret retrieve --inform name -o "$EBC_TMPFS/$ASR_NAME" --outform bin "$ASR_NAME" +rc=$? +if [[ $rc -ne 0 ]]; then + echo "pvsecret failed with rc=${rc}" + exit $rc +fi if [[ ! -f "$EBC_TMPFS/$ASR_NAME" ]]; then echo "$EBC_TMPFS/$ASR_NAME does not exist" + exit 1 fi chmod 400 "$EBC_TMPFS/$ASR_NAME" -exit 0 +exit $?