From 1268a283526ca4b1d11d391ede944f055b4abafd Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Mon, 23 Feb 2026 06:05:25 -0600 Subject: fix: resolve SC2155 shellcheck warnings in custom/lib/ Declare and assign local variables separately to avoid masking return values from command substitutions. --- custom/lib/zfs.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'custom/lib/zfs.sh') diff --git a/custom/lib/zfs.sh b/custom/lib/zfs.sh index 7862f0d..bb948fb 100644 --- a/custom/lib/zfs.sh +++ b/custom/lib/zfs.sh @@ -104,7 +104,8 @@ create_zfs_datasets() { zfs create -o mountpoint=none -o canmount=off "$POOL_NAME/ROOT" # Calculate reservation (20% of pool, capped 5-20G) - local pool_size_bytes=$(zpool get -Hp size "$POOL_NAME" | awk '{print $3}') + local pool_size_bytes + pool_size_bytes=$(zpool get -Hp size "$POOL_NAME" | awk '{print $3}') local pool_size_gb=$((pool_size_bytes / 1024 / 1024 / 1024)) local reserve_gb=$((pool_size_gb / 5)) [[ $reserve_gb -gt 20 ]] && reserve_gb=20 @@ -152,7 +153,8 @@ configure_zfsbootmenu() { if [[ ! -f /etc/hostid ]]; then zgenhostid fi - local host_id=$(hostid) + local host_id + host_id=$(hostid) # Copy hostid to installed system cp /etc/hostid /mnt/etc/hostid @@ -205,9 +207,11 @@ configure_zfsbootmenu() { done # Set as primary boot option - local bootnum=$(efibootmgr | grep "ZFSBootMenu" | head -1 | grep -oP 'Boot\K[0-9A-F]+') + local bootnum + bootnum=$(efibootmgr | grep "ZFSBootMenu" | head -1 | grep -oP 'Boot\K[0-9A-F]+') if [[ -n "$bootnum" ]]; then - local current_order=$(efibootmgr | grep "BootOrder" | cut -d: -f2 | tr -d ' ') + local current_order + current_order=$(efibootmgr | grep "BootOrder" | cut -d: -f2 | tr -d ' ') efibootmgr --bootorder "$bootnum,$current_order" --quiet info "ZFSBootMenu set as primary boot option" fi -- cgit v1.2.3