Skip to content

Commit

Permalink
make shellcheck happy again
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Ammerlaan <[email protected]>
  • Loading branch information
Nowa-Ammerlaan committed Jul 30, 2024
1 parent a932ccb commit a1a795e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions hooks/99-check-diskspace.install
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,22 @@ main() {
fi

einfo "Checking available disk space on ${install_dir}..."

local space_kbi=$(df -Pk "${install_dir}" 2>/dev/null | awk 'FNR == 2 {print $4}')
local space_kbi
space_kbi=$(df -Pk "${install_dir}" 2>/dev/null | awk 'FNR == 2 {print $4}')

if [[ ${?} == 0 && -n ${space_kbi} ]]; then
# Add the typical size of a refind icon(8), bls entry(4) file, typical
# config (272) and System.map(9852)
local required=10200
if [[ ${INSTALLKERNEL_LAYOUT} == "uki" ]]; then
if [[ -f ${uki} ]]; then
required=$((${required} + $(du -kx "${uki}" | awk 'FNR == 1 {print $1}')))
required=$((required + $(du -kx "${uki}" | awk 'FNR == 1 {print $1}')))
fi
else
required=$((${required} + $(du -kx "${img}" | awk 'FNR == 1 {print $1}')))
required=$((required + $(du -kx "${img}" | awk 'FNR == 1 {print $1}')))
INITRD=${INSTALLKERNEL_STAGING_AREA}/initrd
if [[ -f ${initrd} ]]; then
required=$((${required} + $(du -kx "${initrd}" | awk 'FNR == 1 {print $1}')))
required=$((required + $(du -kx "${initrd}" | awk 'FNR == 1 {print $1}')))
fi
fi
if [[ ${space_kbi} -lt ${required} ]]; then
Expand Down
8 changes: 4 additions & 4 deletions hooks/systemd/85-check-diskspace.install
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@ if [[ ${?} == 0 && -n ${space_kbi} ]]; then
if [[ ${KERNEL_INSTALL_LAYOUT} == "uki" ]]; then
UKI=${KERNEL_INSTALL_STAGING_AREA}/uki.efi
if [[ -f ${UKI} ]]; then
required=$((${required} + $(du -kx "${UKI}" | awk 'FNR == 1 {print $1}')))
required=$((required + $(du -kx "${UKI}" | awk 'FNR == 1 {print $1}')))
fi
else
required=$((${required} + $(du -kx "${KERNEL_IMAGE}" | awk 'FNR == 1 {print $1}')))
required=$((required + $(du -kx "${KERNEL_IMAGE}" | awk 'FNR == 1 {print $1}')))
INITRD=${KERNEL_INSTALL_STAGING_AREA}/initrd
if [[ -f ${INITRD} ]]; then
required=$((${required} + $(du -kx "${INITRD}" | awk 'FNR == 1 {print $1}')))
required=$((required + $(du -kx "${INITRD}" | awk 'FNR == 1 {print $1}')))
fi
for CPU in intel amd; do
UCODE=${KERNEL_INSTALL_STAGING_AREA}/microcode-${CPU}
if [[ -f ${UCODE} ]]; then
required=$((${required} + $(du -kx "${UCODE}" | awk 'FNR == 1 {print $1}')))
required=$((required + $(du -kx "${UCODE}" | awk 'FNR == 1 {print $1}')))
fi
done
fi
Expand Down

0 comments on commit a1a795e

Please sign in to comment.