You are not logged in.
Have a Q. about a PKGBUILD.
I'm running a patched up version of archiso.
One of the things done in prepare is copying a script which has the 'sh' shebang.
If running check function this gives the following shellcheck error(s)
In scripts/archiso_profile.sh line 295:
if [ ! -d "${VARIABLES}" ]; then
^---------------------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh/Busybox.
Did you mean:
if [[ ! -d "${VARIABLES}" ]]; thenThis may be valid if the script would be a bash script, but it ain't
Have tried with a 'shellcheck disable' but 'make' won't fall for that.
Also adding sh to shellcheck in the Makefile like this 'shellcheck -s bash -s sh $(SCRIPT_FILES)' will(of course) not work
You have to make a choice here so......
'man make' don't seem to have an option for this or I misunderstand it completely
How do I correctly handle this beside disabling check function which I have done in the past
Or is the only option to rewrite that script in bash ![]()
Offline
Try adding a # shellcheck shell=sh directive below the shebang in your script...
and idk, if the Makefile is invoking `shellcheck -s bash ...`
then the directive will be ignored bcz the cmd line -s flag takes precedence...
Last edited by 5hridhyan (Yesterday 13:56:12)
Offline
Thanks, indeed, I tried that already and yes the Makefile is invoking 'shellcheck -s bash...'
So I think there's no way around this but to leave check disabled as I have always done.
Could rewrite that script of course, but, I guess that makes no sense too
Offline
Could rewrite that script of course, but, I guess that makes no sense too
yeah, rewriting the script in Bash seems unnecessary for a single style warning. If you're already patching archiso, perhaps patching the Makefile in prepare() to invoke shellcheck -s sh for that script, or excluding that specific script from the Bash ShellCheck invocation, could work. Though I suppose that's more of a workaround than a proper solution....
Last edited by 5hridhyan (Yesterday 13:59:19)
Offline