Fix shellcheck issue SC2154

SC2154: var is referenced but not assigned.

The 'rootmnt' variable is set in /usr/share/initramfs-tools/init and if
it's not available, that would be bad.
According to SC2154 you can fix that issue by using '${var:?}' so it
would fail if unset or empty.
So apply that and reference that SC item in the comments.

Also remove it from the exclude list in the CI config file.
This commit is contained in:
Diederik de Haas 2022-11-12 03:24:37 +01:00
parent cf2eb655d9
commit 9bb0488096
No known key found for this signature in database
GPG Key ID: D76E5BCE787EDB6E
2 changed files with 3 additions and 3 deletions

2
debian/salsa-ci.yml vendored
View File

@ -26,7 +26,7 @@ shellcheck:
script:
- apt-get update && apt-get upgrade -y
- apt-get install -y shellcheck
- shellcheck -e SC1090,SC1091,SC2086,SC2154 -s dash $(find rootfs/etc/initramfs-tools -type f -executable | xargs grep -l '^#!/bin/sh')
- shellcheck -e SC1090,SC1091,SC2086 -s dash $(find rootfs/etc/initramfs-tools -type f -executable | xargs grep -l '^#!/bin/sh')
build yamls:
stage: build

View File

@ -33,8 +33,8 @@ fi
log_begin_msg "$0 resizing $ROOT"
# Unmount for safety
umount "${rootmnt}"
# Unmount for safety; fail if unset or empty (shellcheck SC2154)
umount "${rootmnt:?}"
# Expand the partition size to fill the entire device
parted -s $rootdev resizepart $rootpart_nr 100%