[SOLVED] How do i write to /etc/udev/rules.d/ from with in a makefile?
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How do i write to /etc/udev/rules.d/ from with in a makefile?
I am updating a makefile for a kernel module for a proprietary DIO card. Everything works well and I can talk to my device fine as root. I can create a udev rule to give group privileges and again works great as long as I am a member of said group.
I would like to have the makefile create the udev rule when "make install" is run by a normal user. How do I do this? Right now I have it generating the udev rule by "sudo echo "rule" >> /tmp/test.rule" and then "sudo cp test.rule >> /etc/udev/rules.d/". This asks for the root password, but does create the rule.(It would not let me create the file directly to /udev/rules.d/...permission denied even when the root password was given.
Sorry to be long winded, just wanted to give as much info as possible.
Maybe use the make command to compile, but to be safe, run "sudo make all' IF 'all:' is a target in the file; otherwise run 'sudo make install'
Run a ./configure that allows you to interactively set up the temp rulefile. Use 'sudo make install' to actually put that into the udev ruleset. Best advice:
Use a combo of awk, grep, sed (the gmakefiles use these; I think the kernel makefiles do as well, as to other makefiles)
Last edited by PenGUiN_6_1; 07-23-2014 at 03:23 PM.
@PenGUiN_6_1, I want the normal user to able to run make with out having to enter the root password. Is there an equivalent to something along the lines of SETUID that can be used in a makefile?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.