You are not logged in.

#1 Yesterday 12:32:54

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,598

check function of a PKGBUILD

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}" ]]; then

This 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 hmm

Offline

#2 Yesterday 12:51:04

5hridhyan
Member
From: A fake and corrupt democracy
Registered: 2025-12-25
Posts: 963
Website

Re: check function of a PKGBUILD

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

#3 Yesterday 13:20:18

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,598

Re: check function of a PKGBUILD

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

#4 Yesterday 13:33:01

5hridhyan
Member
From: A fake and corrupt democracy
Registered: 2025-12-25
Posts: 963
Website

Re: check function of a PKGBUILD

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

Board footer

Powered by FluxBB