Skip to content

installkernel: remove bashisms#485

Merged
Foxboron merged 1 commit intoFoxboron:masterfrom
Proto1337:master
Mar 16, 2026
Merged

installkernel: remove bashisms#485
Foxboron merged 1 commit intoFoxboron:masterfrom
Proto1337:master

Conversation

@Proto1337
Copy link
Copy Markdown
Contributor

Convert the installkernel script to POSIX sh by removing bash-specific syntax
that caused failures on systems where /bin/sh is not bash (e.g. dash):

  • Replacing [[…]] with POSIX […] syntax (SC3010)
  • Using = instead of == for string comparisons (SC3014)
  • Replacing $EUID with $(id -u) (SC3028)
  • Replacing echo -e and "\e" escapes with printf and "\033" (SC3037)
  • Quoting variables to prevent globbing and word splitting (SC2086)

After this change, the script runs correctly with /bin/sh symlinked to dash.
It also passes ShellCheck with no POSIX warnings.

Remove bashisms from installkernel script that leads to failure when
executing on systems where /bin/sh is not symlinked to bash.
@Foxboron
Copy link
Copy Markdown
Owner

Foxboron commented Jan 7, 2026

Is there a reason this can't just be bash?

@Proto1337
Copy link
Copy Markdown
Contributor Author

There isn't a single reason.
I saw that the kernel-install script was POSIX-compliant so I decided to do the same here.

Honestly changing the shebang to #!/usr/bin/env bash would already do the trick. The installkernel scripts in Gentoo also use #!/usr/bin/env bash as shebang.

@Foxboron
Copy link
Copy Markdown
Owner

ACK. I'll merge this. It seems like this is intended for Debian but the conventions are taken from Gentoo. I suspect it makes more sense to have this POSIX compliant.

@Foxboron Foxboron merged commit 1b913e7 into Foxboron:master Mar 16, 2026
1 of 6 checks passed
@Foxboron
Copy link
Copy Markdown
Owner

Thanks!

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.

2 participants