Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup shellcheck and fix all issues #189

Merged
merged 28 commits into from
Dec 2, 2024
Merged

Setup shellcheck and fix all issues #189

merged 28 commits into from
Dec 2, 2024

Conversation

zeha
Copy link
Member

@zeha zeha commented Nov 26, 2024

Setup shellcheck in GitHub Actions and fix all reported issues.

@zeha zeha self-assigned this Nov 26, 2024
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

shellcheck

🚫 [shellcheck] reported by reviewdog 🐶
SIGKILL/SIGSTOP can not be trapped. SC2173

trap bailout 1 2 3 3 6 9 14 15


[shellcheck] reported by reviewdog 🐶
expr is antiquated. Consider rewriting this using $((..)), ${} or [[ ]]. SC2003

local FILL=$(expr "$COUNT" - "$1")


⚠️ [shellcheck] reported by reviewdog 🐶
Declare and assign separately to avoid masking return values. SC2155

local FILL=$(expr "$FILL" - 1)


[shellcheck] reported by reviewdog 🐶
expr is antiquated. Consider rewriting this using $((..)), ${} or [[ ]]. SC2003

local FILL=$(expr "$FILL" - 1)


⚠️ [shellcheck] reported by reviewdog 🐶
Declare and assign separately to avoid masking return values. SC2155

local FILL=$(expr "$FILL" + 1)


[shellcheck] reported by reviewdog 🐶
expr is antiquated. Consider rewriting this using $((..)), ${} or [[ ]]. SC2003

local FILL=$(expr "$FILL" + 1)


[shellcheck] reported by reviewdog 🐶
$/${} is unnecessary on arithmetic variables. SC2004

shift $(($OPTIND - 1)) # set ARGV to the first not parsed commandline parameter


📝 [shellcheck] reported by reviewdog 🐶
Use '[:lower:]' to support accents and foreign alphabets. SC2018

[ -n "$CLASSES" ] || CLASSES="GRMLBASE,GRML_FULL,$(echo "${ARCH}" | tr 'a-z' 'A-Z')"


📝 [shellcheck] reported by reviewdog 🐶
Use '[:upper:]' to support accents and foreign alphabets. SC2019

[ -n "$CLASSES" ] || CLASSES="GRMLBASE,GRML_FULL,$(echo "${ARCH}" | tr 'a-z' 'A-Z')"


⚠️ [shellcheck] reported by reviewdog 🐶
Declare and assign separately to avoid masking return values. SC2155

[ -n "$GRML_NAME" ] && export SHORT_NAME="$(echo "$GRML_NAME" | tr -d ',./;\- ')"


📝 [shellcheck] reported by reviewdog 🐶
read without -r will mangle backslashes. SC2162

read a


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] || [ q ] as [ p -o q ] is not well defined. SC2166

if ! [ "$a" = 'y' -o "$a" = 'Y' ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

[ -n "${CHROOT_OUTPUT}" -a -d "${CHROOT_OUTPUT}" ] && rm -r "${CHROOT_OUTPUT}"


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

[ -n "${BUILD_OUTPUT}" -a -d "${BUILD_OUTPUT}" ] && rm -r "${BUILD_OUTPUT}"


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

[ -n "${ISO_OUTPUT}" -a -d "${ISO_OUTPUT}" ] && rm -r "${ISO_OUTPUT}"


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

[ -n "${LOG_OUTPUT}" -a -d "${LOG_OUTPUT}" ] && rm -r "${LOG_OUTPUT}"


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

[ -n "${NETBOOT}" -a -d "${NETBOOT}" ] && rm -r "${NETBOOT}"


⚠️ [shellcheck] reported by reviewdog 🐶
Declare and assign separately to avoid masking return values. SC2155

local tempdir=$(mktemp -d)


⚠️ [shellcheck] reported by reviewdog 🐶
Don't use ls | grep. Use a glob or a for loop with a condition to allow non-alphanumeric filenames. SC2010

if ls "${tempdir}"/live/*/*.squashfs 2>/dev/null | grep -q . ; then


📝 [shellcheck] reported by reviewdog 🐶
Use '[:lower:]' to support accents and foreign alphabets. SC2018

*) CLASSES="DEBIAN_$(echo "$SUITE" | tr 'a-z' 'A-Z'),$CLASSES";;


📝 [shellcheck] reported by reviewdog 🐶
Use '[:upper:]' to support accents and foreign alphabets. SC2019

*) CLASSES="DEBIAN_$(echo "$SUITE" | tr 'a-z' 'A-Z'),$CLASSES";;


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] || [ q ] as [ p -o q ] is not well defined. SC2166

if [ -n "$UPDATE" -o -n "$BUILD_ONLY" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] || [ q ] as [ p -o q ] is not well defined. SC2166

if [ -n "$UPDATE" -o -n "$BUILD_ONLY" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

if [ -d "$CHROOT_OUTPUT/bin" -a -z "$UPDATE" -a -z "$BUILD_ONLY" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

if [ -d "$CHROOT_OUTPUT/bin" -a -z "$UPDATE" -a -z "$BUILD_ONLY" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Expanding an array without an index only gives the first element. SC2128

RC="$PIPESTATUS" # notice: bash-only


📝 [shellcheck] reported by reviewdog 🐶
To read lines rather than words, pipe/redirect to a 'while read' loop. SC2013

for package in $(awk '{print $1}' "${CHECKLOG}/package_errors.log" | sed 's;/;\\/;') ; do


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

if [ -n "$EXIT_ON_MISSING_PACKAGES" -a -z "$BUILD_DIRTY" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Declare and assign separately to avoid masking return values. SC2155

local GRUBCFG_TMP=$(mktemp)


⚠️ [shellcheck] reported by reviewdog 🐶
Don't use ls | grep. Use a glob or a for loop with a condition to allow non-alphanumeric filenames. SC2010

INITRD=$(ls "$CHROOT_OUTPUT/boot/initrd*" 2>/dev/null| grep -v '.bak$' | sort -r | head -1)


📝 [shellcheck] reported by reviewdog 🐶
Use find instead of ls to better handle non-alphanumeric filenames. SC2012

KERNEL_IMAGE=$(ls "$CHROOT_OUTPUT/boot/vmlinuz*" 2>/dev/null | sort -r | head -1)


⚠️ [shellcheck] reported by reviewdog 🐶
This $? refers to echo/printf, not a previous command. Assign to variable to avoid it being overwritten. SC2320

eend $?


⚠️ [shellcheck] reported by reviewdog 🐶
This $? refers to echo/printf, not a previous command. Assign to variable to avoid it being overwritten. SC2320

eend $?


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

if [ -r "${CHROOT_OUTPUT}/boot/efi.img" -a -r "${CHROOT_OUTPUT}/boot/bootaa64.efi" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

elif [ -r "${CHROOT_OUTPUT}/boot/efi.img" -a -r "${CHROOT_OUTPUT}/boot/bootx64.efi" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

elif [ -r "${CHROOT_OUTPUT}/boot/efi.img" -a -r "${CHROOT_OUTPUT}/boot/bootia32.efi" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
For loops over find output are fragile. Use find -exec or a while read loop. SC2044

for file in $(find "${BUILD_OUTPUT}" -name "*%$param%*") ; do


[shellcheck] reported by reviewdog 🐶
Consider using { cmd1; cmd2; } >> file instead of individual redirects. SC2129

echo "include isoprompt.cfg" >> "${BUILD_OUTPUT}/boot/isolinux/grmlmain.cfg"


⚠️ [shellcheck] reported by reviewdog 🐶
This $? refers to echo/printf, not a previous command. Assign to variable to avoid it being overwritten. SC2320

eend $?


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

if [ -f "$BUILD_OUTPUT"/live/"${GRML_NAME}".squashfs -a -z "$UPDATE" -a -z "$BUILD_ONLY" -a -z "$BUILD_DIRTY" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

if [ -f "$BUILD_OUTPUT"/live/"${GRML_NAME}".squashfs -a -z "$UPDATE" -a -z "$BUILD_ONLY" -a -z "$BUILD_DIRTY" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

if [ -f "$BUILD_OUTPUT"/live/"${GRML_NAME}".squashfs -a -z "$UPDATE" -a -z "$BUILD_ONLY" -a -z "$BUILD_DIRTY" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

if [ -n "$SQUASHFS_EXCLUDES_FILE" -a "$SQUASHFS_EXCLUDES_FILE" ] ; then


📝 [shellcheck] reported by reviewdog 🐶
Make sure not to read and write the same file in the same pipeline. SC2094

find ../.. -type f -not -name md5sums -not -name isolinux.bin -exec md5sum {} \; > md5sums )


📝 [shellcheck] reported by reviewdog 🐶
Make sure not to read and write the same file in the same pipeline. SC2094

find ../.. -type f -not -name md5sums -not -name isolinux.bin -exec md5sum {} \; > md5sums )


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

if [ -f "${ISO_OUTPUT}/${ISO_NAME}" -a -z "$UPDATE" -a -z "$BUILD_ONLY" -a -z "$BUILD_DIRTY" -a "$FORCE_ISO_REBUILD" = "false" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

if [ -f "${ISO_OUTPUT}/${ISO_NAME}" -a -z "$UPDATE" -a -z "$BUILD_ONLY" -a -z "$BUILD_DIRTY" -a "$FORCE_ISO_REBUILD" = "false" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

if [ -f "${ISO_OUTPUT}/${ISO_NAME}" -a -z "$UPDATE" -a -z "$BUILD_ONLY" -a -z "$BUILD_DIRTY" -a "$FORCE_ISO_REBUILD" = "false" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

if [ -f "${ISO_OUTPUT}/${ISO_NAME}" -a -z "$UPDATE" -a -z "$BUILD_ONLY" -a -z "$BUILD_DIRTY" -a "$FORCE_ISO_REBUILD" = "false" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Use 'cd ... || exit' or 'cd ... || return' in case cd fails. SC2164

cd "$CURRENT_DIR"


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

if [ -f "${OUTPUT_FILE}" -a -z "$UPDATE" -a -z "$BUILD_ONLY" -a -z "$BUILD_DIRTY" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

if [ -f "${OUTPUT_FILE}" -a -z "$UPDATE" -a -z "$BUILD_ONLY" -a -z "$BUILD_DIRTY" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

if [ -f "${OUTPUT_FILE}" -a -z "$UPDATE" -a -z "$BUILD_ONLY" -a -z "$BUILD_DIRTY" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Use 'cd ... || exit' or 'cd ... || return' in case cd fails. SC2164

cd "$(dirname "${OUTPUT_FILE}")"

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

shellcheck

⚠️ [shellcheck] reported by reviewdog 🐶
Don't use ls | grep. Use a glob or a for loop with a condition to allow non-alphanumeric filenames. SC2010

if ls "${tempdir}"/live/*/*.squashfs 2>/dev/null | grep -q . ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] || [ q ] as [ p -o q ] is not well defined. SC2166

if [ -n "$UPDATE" -o -n "$BUILD_ONLY" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] || [ q ] as [ p -o q ] is not well defined. SC2166

if [ -n "$UPDATE" -o -n "$BUILD_ONLY" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

if [ -d "$CHROOT_OUTPUT/bin" -a -z "$UPDATE" -a -z "$BUILD_ONLY" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

if [ -d "$CHROOT_OUTPUT/bin" -a -z "$UPDATE" -a -z "$BUILD_ONLY" ] ; then


📝 [shellcheck] reported by reviewdog 🐶
To read lines rather than words, pipe/redirect to a 'while read' loop. SC2013

for package in $(awk '{print $1}' "${CHECKLOG}/package_errors.log" | sed 's;/;\\/;') ; do


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

if [ -n "$EXIT_ON_MISSING_PACKAGES" -a -z "$BUILD_DIRTY" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Declare and assign separately to avoid masking return values. SC2155

local GRUBCFG_TMP=$(mktemp)


⚠️ [shellcheck] reported by reviewdog 🐶
This $? refers to echo/printf, not a previous command. Assign to variable to avoid it being overwritten. SC2320

eend $?


⚠️ [shellcheck] reported by reviewdog 🐶
This $? refers to echo/printf, not a previous command. Assign to variable to avoid it being overwritten. SC2320

eend $?


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

if [ -r "${CHROOT_OUTPUT}/boot/efi.img" -a -r "${CHROOT_OUTPUT}/boot/bootaa64.efi" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

elif [ -r "${CHROOT_OUTPUT}/boot/efi.img" -a -r "${CHROOT_OUTPUT}/boot/bootx64.efi" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

elif [ -r "${CHROOT_OUTPUT}/boot/efi.img" -a -r "${CHROOT_OUTPUT}/boot/bootia32.efi" ] ; then


[shellcheck] reported by reviewdog 🐶
Consider using { cmd1; cmd2; } >> file instead of individual redirects. SC2129

echo "include isoprompt.cfg" >> "${BUILD_OUTPUT}/boot/isolinux/grmlmain.cfg"


⚠️ [shellcheck] reported by reviewdog 🐶
This $? refers to echo/printf, not a previous command. Assign to variable to avoid it being overwritten. SC2320

eend $?


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

if [ -n "$SQUASHFS_EXCLUDES_FILE" -a "$SQUASHFS_EXCLUDES_FILE" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

if [ -f "${ISO_OUTPUT}/${ISO_NAME}" -a -z "$UPDATE" -a -z "$BUILD_ONLY" -a -z "$BUILD_DIRTY" -a "$FORCE_ISO_REBUILD" = "false" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

if [ -f "${ISO_OUTPUT}/${ISO_NAME}" -a -z "$UPDATE" -a -z "$BUILD_ONLY" -a -z "$BUILD_DIRTY" -a "$FORCE_ISO_REBUILD" = "false" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

if [ -f "${ISO_OUTPUT}/${ISO_NAME}" -a -z "$UPDATE" -a -z "$BUILD_ONLY" -a -z "$BUILD_DIRTY" -a "$FORCE_ISO_REBUILD" = "false" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

if [ -f "${ISO_OUTPUT}/${ISO_NAME}" -a -z "$UPDATE" -a -z "$BUILD_ONLY" -a -z "$BUILD_DIRTY" -a "$FORCE_ISO_REBUILD" = "false" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Use 'cd ... || exit' or 'cd ... || return' in case cd fails. SC2164

cd "$CURRENT_DIR"


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

if [ -f "${OUTPUT_FILE}" -a -z "$UPDATE" -a -z "$BUILD_ONLY" -a -z "$BUILD_DIRTY" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

if [ -f "${OUTPUT_FILE}" -a -z "$UPDATE" -a -z "$BUILD_ONLY" -a -z "$BUILD_DIRTY" ] ; then


⚠️ [shellcheck] reported by reviewdog 🐶
Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. SC2166

if [ -f "${OUTPUT_FILE}" -a -z "$UPDATE" -a -z "$BUILD_ONLY" -a -z "$BUILD_DIRTY" ] ; then

@zeha zeha force-pushed the shellcheck branch 5 times, most recently from 596da04 to fe3eef9 Compare November 26, 2024 17:03
@zeha zeha requested a review from mika November 26, 2024 17:05
@zeha
Copy link
Member Author

zeha commented Nov 26, 2024

Running a local test build right now. I hope I didn't break anything, but not super confident.

@evgeni
Copy link
Member

evgeni commented Nov 26, 2024

FWIW: We've been using https://github.com/redhat-plumbers-in-action/differential-shellcheck which has the benefit of only failing on newly added violations, not on existing offenses

@zeha zeha changed the title GHA: setup shellcheck Setup shellcheck and fix all issues Nov 26, 2024
@zeha
Copy link
Member Author

zeha commented Nov 26, 2024

FWIW: We've been using https://github.com/redhat-plumbers-in-action/differential-shellcheck which has the benefit of only failing on newly added violations, not on existing offenses

Ah, very cool. I've "just" fixed all issues ;-)

@evgeni
Copy link
Member

evgeni commented Nov 26, 2024

Yeah, I'm never that motivated when working with shell ;)

@zeha
Copy link
Member Author

zeha commented Nov 27, 2024

Running a local test build right now. I hope I didn't break anything, but not super confident.

This found an issue or two which I've fixed.

Copy link
Member

@mika mika left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for delay, had to find some proper time to go through all of this :)
Thanks a bunch for working on this, only some small nitpicks and two bugs, other than that LGTM!

@@ -43,7 +43,7 @@ cat > "${WORKING_DIR}/pxelinux.cfg/default" << EOF
default grml
label grml
kernel vmlinuz
append initrd=initrd.img root=/dev/nfs rw nfsroot=192.168.0.1:/live/image boot=live apm=power-off quiet nomce noprompt noeject vga=791 net.ifnames=0
append initrd=initrd.img root=/dev/nfs rw nfsroot=192.168.0.1:/live/image boot=live apm=power-off quiet nomce noprompt noeject vga=791 net.ifnames=0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't drop the trailing whitespace char here (it's relevant when e.g. someone wants to append something like ssh=foobar)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack, that was an overzealous text editor and an oversight on my part.

@@ -23,17 +26,17 @@ if [ "$FAI_ACTION" = "softupdate" ] ; then

# /etc/resolv.conf is usually a symlink, pointing out of the chroot.
# Make it a file with known contents.
rm -f "${target}"/etc/resolv.conf
rm -f "$target"/etc/resolv.conf
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we have a strange mixture of "${target}" vs "$target" now :p
(I'm aware that this is inconsistent over all the code base, nowadays I prefer to use "$f" and "${foo}" (so no ${} for single char variables, whereas ${} for >=2 chars)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I tried to aim for some local consistency... at some point I gave up. We need to make a call and then update all places in one go.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nod :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed at least instsoft.GRMLBASE to be in one style overall.

@@ -29,9 +32,10 @@ echo "$0: Installing latest kernel and its headers, as well as build-essential."
# keeping track of what gets installed. This is an ugly hack and should not
# be needed, but without it the resulting ISO is hundreds of megabytes
# larger. I hope this kludge can go away eventually.
extra_packages=($($ROOTCMD apt-get --assume-no --download-only --mark-auto -u install \
mapfile -t extra_packages <($ROOTCMD \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't work, AFAICT, needs to be:

mapfile -t extra_packages < <($ROOTCMD ...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. It also needs some extra sed to actually work. Fixed both instances.

@@ -54,7 +58,11 @@ else
fi

echo "$0: Installing zfs-dkms itself."
extra_packages=(${extra_packages[@]} $($ROOTCMD apt-get --assume-no --download-only --mark-auto -u install zfs-dkms | sed '0,/The following NEW packages will be installed/d;/^[^ ]/,$d'))
mapfile -t zfs_packages <($ROOTCMD \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed as above

@zeha zeha requested a review from mika December 2, 2024 16:01
Copy link
Member

@mika mika left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, LGTM! 🥳

@zeha zeha merged commit e50e0a8 into master Dec 2, 2024
10 checks passed
@zeha zeha deleted the shellcheck branch December 2, 2024 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants