Skip to content

contrib/check-config.sh: Make script POSIX#42410

Merged
thaJeztah merged 4 commits intomoby:masterfrom
joakimr-axis:joakimr-axis_check-config-posix
May 27, 2021
Merged

contrib/check-config.sh: Make script POSIX#42410
thaJeztah merged 4 commits intomoby:masterfrom
joakimr-axis:joakimr-axis_check-config-posix

Conversation

@joakimr-axis
Copy link
Contributor

- What I did
I needed to run check-config.sh on a small system that doesn't have bash. So I did the changes needed to make it a POSIX shell script and thus remove the bash dependency. Having done that for my own needs, I thought I'd share this more portable version upstreams.

- How I did it
Replaced bashisms with POSIX

- How to verify it
Explicitly run check-config.sh with a POSIX shell such as e.g. dash.

- Description for the changelog

check-config.sh is now a POSIX shell script (and not depending on bash).

- A picture of a cute animal (not mandatory but encouraged)
image

@thaJeztah thaJeztah added area/contrib kind/refactor PR's that refactor, or clean-up code status/2-code-review labels May 25, 2021
@thaJeztah
Copy link
Member

thaJeztah commented May 25, 2021

Looks like shfmt is picky about the indentation of the comment;

Screenshot 2021-05-25 at 13 02 32

Please reformat the shell scripts with `shfmt -w -bn -ci -sr`.

On systems that do not have bash, the current bash-based
check-config.sh won't run. Making check-config.sh a POSIX shell script
instead makes it more portable.

Signed-off-by: Joakim Roubert <joakim.roubert@axis.com>
@thaJeztah
Copy link
Member

@tianon ptal

Copy link
Member

@tianon tianon left a comment

Choose a reason for hiding this comment

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

Overall, I'm a little sad about all the nice Bash features we have to give up (esp. local and arrays that let us have long lists without \ on every line), but I agree with the goal. 😄 👍

joakimr-axis and others added 3 commits May 27, 2021 09:21
Co-authored-by: Tianon Gravi <admwiggin@gmail.com>
Signed-off-by: Joakim Roubert <joakimr@axis.com>
Co-authored-by: Tianon Gravi <admwiggin@gmail.com>
Signed-off-by: Joakim Roubert <joakimr@axis.com>
Co-authored-by: Tianon Gravi <admwiggin@gmail.com>
Signed-off-by: Joakim Roubert <joakimr@axis.com>
Copy link
Member

@tianon tianon left a comment

Choose a reason for hiding this comment

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

👍

@thaJeztah thaJeztah added this to the 21.xx milestone May 27, 2021
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

tested it locally, and the world didn't explode

@thaJeztah thaJeztah merged commit cb9f425 into moby:master May 27, 2021
@joakimr-axis joakimr-axis deleted the joakimr-axis_check-config-posix branch May 28, 2021 05:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/contrib kind/refactor PR's that refactor, or clean-up code status/2-code-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants