summaryrefslogtreecommitdiff
path: root/rootfs/etc/initramfs-tools/scripts
diff options
context:
space:
mode:
authorDiederik de Haas <didi.debian@cknow.org>2022-11-12 03:45:29 +0100
committerDiederik de Haas <didi.debian@cknow.org>2022-11-14 22:38:56 +0100
commit422832740be2973ee1639cddb13d73b2cc863e1d (patch)
tree31d5bd92b868130ace15c648feecc4ec1057d7f5 /rootfs/etc/initramfs-tools/scripts
parent9bb048809659f6e5537a59d0fbaa3edd14b4b206 (diff)
Fix shellcheck issue SC2086 (quotes)
SC2086: Double quote to prevent globbing and word splitting. Also remove it from the exclude list in the CI config file.
Diffstat (limited to 'rootfs/etc/initramfs-tools/scripts')
-rwxr-xr-xrootfs/etc/initramfs-tools/scripts/local-bottom/rpi-resizerootfs18
1 files changed, 9 insertions, 9 deletions
diff --git a/rootfs/etc/initramfs-tools/scripts/local-bottom/rpi-resizerootfs b/rootfs/etc/initramfs-tools/scripts/local-bottom/rpi-resizerootfs
index a426a3f..680e133 100755
--- a/rootfs/etc/initramfs-tools/scripts/local-bottom/rpi-resizerootfs
+++ b/rootfs/etc/initramfs-tools/scripts/local-bottom/rpi-resizerootfs
@@ -14,18 +14,18 @@ esac
. /scripts/functions
# Given the root partition, get the underlying device and partition number
-rootpart=$(realpath $ROOT)
-rootpart_nr=$(blkid -sPART_ENTRY_NUMBER -o value -p $rootpart)
+rootpart=$(realpath "$ROOT")
+rootpart_nr=$(blkid -sPART_ENTRY_NUMBER -o value -p "$rootpart")
rootdev="/dev/$(lsblk -no pkname "$rootpart")"
# Parted will detect if the GPT label is messed up and fix it
# automatically, we just need to tell it to do so.
-parted -s $rootdev print 2>&1 | grep -z "fix the GPT" && {
- echo "Fix" | parted ---pretend-input-tty $rootdev print
+parted -s "$rootdev" print 2>&1 | grep -z "fix the GPT" && {
+ echo "Fix" | parted ---pretend-input-tty "$rootdev" print
}
# Check if there's free space at the end of the device
-free_space="$(parted -m -s $rootdev print free | tail -n1 | grep free)"
+free_space="$(parted -m -s "$rootdev" print free | tail -n1 | grep free)"
if test -z "$free_space"; then
# Great, we already resized; nothing left to do!
exit 0
@@ -37,16 +37,16 @@ log_begin_msg "$0 resizing $ROOT"
umount "${rootmnt:?}"
# Expand the partition size to fill the entire device
-parted -s $rootdev resizepart $rootpart_nr 100%
+parted -s "$rootdev" resizepart "$rootpart_nr" 100%
wait_for_udev 5
# Now resize the filesystem
-partprobe $rootdev
-resize2fs $rootpart
+partprobe "$rootdev"
+resize2fs "$rootpart"
# Remount root
-if ! mount -r ${FSTYPE:+-t "${FSTYPE}"} ${ROOTFLAGS} "${ROOT}" "${rootmnt?}"; then
+if ! mount -r ${FSTYPE:+-t "${FSTYPE}"} "${ROOTFLAGS}" "${ROOT}" "${rootmnt?}"; then
panic "Failed to mount ${ROOT} as root file system."
fi