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.
This commit is contained in:
parent
9bb0488096
commit
422832740b
|
@ -26,7 +26,7 @@ shellcheck:
|
||||||
script:
|
script:
|
||||||
- apt-get update && apt-get upgrade -y
|
- apt-get update && apt-get upgrade -y
|
||||||
- apt-get install -y shellcheck
|
- apt-get install -y shellcheck
|
||||||
- shellcheck -e SC1090,SC1091,SC2086 -s dash $(find rootfs/etc/initramfs-tools -type f -executable | xargs grep -l '^#!/bin/sh')
|
- shellcheck -e SC1090,SC1091 -s dash $(find rootfs/etc/initramfs-tools -type f -executable | xargs grep -l '^#!/bin/sh')
|
||||||
|
|
||||||
build yamls:
|
build yamls:
|
||||||
stage: build
|
stage: build
|
||||||
|
|
|
@ -14,18 +14,18 @@ esac
|
||||||
. /scripts/functions
|
. /scripts/functions
|
||||||
|
|
||||||
# Given the root partition, get the underlying device and partition number
|
# Given the root partition, get the underlying device and partition number
|
||||||
rootpart=$(realpath $ROOT)
|
rootpart=$(realpath "$ROOT")
|
||||||
rootpart_nr=$(blkid -sPART_ENTRY_NUMBER -o value -p $rootpart)
|
rootpart_nr=$(blkid -sPART_ENTRY_NUMBER -o value -p "$rootpart")
|
||||||
rootdev="/dev/$(lsblk -no pkname "$rootpart")"
|
rootdev="/dev/$(lsblk -no pkname "$rootpart")"
|
||||||
|
|
||||||
# Parted will detect if the GPT label is messed up and fix it
|
# Parted will detect if the GPT label is messed up and fix it
|
||||||
# automatically, we just need to tell it to do so.
|
# automatically, we just need to tell it to do so.
|
||||||
parted -s $rootdev print 2>&1 | grep -z "fix the GPT" && {
|
parted -s "$rootdev" print 2>&1 | grep -z "fix the GPT" && {
|
||||||
echo "Fix" | parted ---pretend-input-tty $rootdev print
|
echo "Fix" | parted ---pretend-input-tty "$rootdev" print
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if there's free space at the end of the device
|
# 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
|
if test -z "$free_space"; then
|
||||||
# Great, we already resized; nothing left to do!
|
# Great, we already resized; nothing left to do!
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -37,16 +37,16 @@ log_begin_msg "$0 resizing $ROOT"
|
||||||
umount "${rootmnt:?}"
|
umount "${rootmnt:?}"
|
||||||
|
|
||||||
# Expand the partition size to fill the entire device
|
# 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
|
wait_for_udev 5
|
||||||
|
|
||||||
# Now resize the filesystem
|
# Now resize the filesystem
|
||||||
partprobe $rootdev
|
partprobe "$rootdev"
|
||||||
resize2fs $rootpart
|
resize2fs "$rootpart"
|
||||||
|
|
||||||
# Remount root
|
# 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."
|
panic "Failed to mount ${ROOT} as root file system."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue