Skip to content

Added a test if there are SO commands.#93

Open
fike wants to merge 1 commit into
patjak:masterfrom
fike:make_test_commands
Open

Added a test if there are SO commands.#93
fike wants to merge 1 commit into
patjak:masterfrom
fike:make_test_commands

Conversation

@fike
Copy link
Copy Markdown

@fike fike commented Aug 31, 2016

I reinstalled OS on my laptop and I didn't install all programas (curl). I did a simple test in firmware/Makefile if there aren' t curl, cpio or zxcat, show a message and exit.

    @echo "Checking dependencies for driver download..."
    **@if [ 3 != "$(which curl cpio xzcat| wc -l)" ]; then echo -e "Missing commands, please check if your OS has curl, cpio and xzcat.\n" && exit 1; fi**
    @echo ""

@patjak
Copy link
Copy Markdown
Owner

patjak commented Sep 28, 2016

This fails for me even though I have curl, cpio and xzcat installed. Also is Yoda style evaluations enforced by bash or is the force just weak with that one?

Comment thread firmware/Makefile
@echo ""
@echo "Checking dependencies for driver download..."
@which curl xzcat cpio
@if [ 3 != "$(which curl cpio xzcat| wc -l)" ]; then echo -e "Missing commands, please check if your OS has curl, cpio and xzcat.\n" && exit 1; fi
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Might be cleaner as:

@for required in curl cpio xzcat; do if which $required > /dev/null; then echo "Found $required"; else echo "Missing $required. Exiting."; exit 1; fi; done

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

So, I have to agree this a little bit obfuscate. Perhaps a just additional instead use for or if.

My suggestion is:

@echo "Checking dependencies (curl, xzcat, cpio) for driver download..."

Indirectly they will know missing something. What do you think, @patjak .

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