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

Testing systemctl existence before executing it #959

Merged
merged 1 commit into from May 10, 2019

Conversation

kirawrath
Copy link
Contributor

Since commit c9614c4 kpatch has support for upstart systems,
which means we should test the existence of systemctl before executing
it.

The command command is POSIX compliant, and should be widely
available.

Signed-of-by: Bruno Loreto loretob@amazon.com

@joe-lawrence
Copy link
Contributor

This change makes sense, though make check has a complaint:

$ make check
shellcheck kpatch/kpatch kpatch-build/kpatch-build kpatch-build/kpatch-gcc
In kpatch/kpatch line 472:
	command -v systemctl 2>&1 > /dev/null && systemctl enable kpatch.service
                             ^-- SC2069: The order of the 2>&1 and the redirect matters. The 2>&1 has to be last.
make: *** [check] Error 1
The command "make check" exited with 2.

Maybe command -v systemctl &> /dev/null && systemctl enable kpatch.service would appease shellcheck?

@jpoimboe
Copy link
Member

jpoimboe commented May 9, 2019

Also is there something we need to do to make sure "kpatch install" actually enables the patch on boot (something similar to kpatch.service) on upstart?

@kirawrath
Copy link
Contributor Author

Joe: I would love to use &>, however that is a bash-4+ only construct, and looking at the rest of the code, I noticed that only the 2>&1 is employed, so I will keep the same style, using 2>&1, but in the correct order this time.

Josh: For upstart such command is not necessary, simply placing the required files in /etc/init (which is already done) should suffice.

Since commit c9614c4 kpatch has support for upstart systems,
which means we should test the existence of `systemctl` before executing
it.

The command `command` is POSIX compliant, and should be widely
available.

Signed-of-by: Bruno Loreto <loretob@amazon.com>
Copy link
Contributor

@joe-lawrence joe-lawrence left a comment

Choose a reason for hiding this comment

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

👍

@joe-lawrence joe-lawrence merged commit d304740 into dynup:master May 10, 2019
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.

None yet

3 participants