lkrg-org / lkrg

Linux Kernel Runtime Guard
https://lkrg.org
Other
402 stars 72 forks source link

make bootup scripts independent of cwd, add usage and root checks #278

Closed vobst closed 12 months ago

vobst commented 12 months ago

Description

For my use case it happened that I ran the install scripts not from the root of the project (and not through make). I noticed that they fail "silently" in that case. I thought it would not hurt to update the scripts to be more self-sufficient, i.e., independent of the cwd and with some usage and root checks.

How Has This Been Tested?

Tested that it works as expected for systemd, cannot say anything about the openrc part.

solardiz commented 12 months ago

Regarding requiring root, I guess we could at some point want to make the opposite move - allow for running the scripts as non-root during package build (installing into a build user writable "buildroot" tree), skipping the actions that require root. However, for now I don't mind introducing the root checks as this is consistent with the current inflexible scripts.

solardiz commented 12 months ago

@mrl5 Please review the OpenRC script changes here. Thank you!

vobst commented 12 months ago

Thanks for the feedback! I tried to incorporate it and added a commit to this PR.

As the Readme change is somewhat independent of the others I originally opened a separate PR, but I don't mind if it is merged as part of this one.

solardiz commented 12 months ago

Also, we prefer to mention the changed subsystem or file name in the commit message (near the beginning). Your "make bootup scripts independent of cwd, add usage and root checks" does mention "bootup scripts", but "Add remark about lkrg-bootup.sh to DKMS section" leaves it unclear where the changes are being made (where that "DKMS section" is) without looking at the changes themselves. I suggest replacing the latter commit message with "README: Add remark about lkrg-bootup.sh to DKMS section".

vobst commented 12 months ago

Thanks for being patient with me, what you say of course makes sense. I did a rebase and force-push, is it looking OK now?

solardiz commented 12 months ago

@mrl5 I think I'll merge this now. You can then test on an OpenRC system and let us know of your results in a comment here, and if there are any issues then send us another PR to fix those (but I don't expect issues). Thank you!