Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a test if there are SO commands. #93

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Added a test if there are SO commands. #93

wants to merge 1 commit into from

Conversation

fike
Copy link

@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
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?

@@ -33,7 +33,7 @@ deb: all
$(OSX_DRV):
@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

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