[SOLVED] running a string as a command as it pertains to mkinitrd_command_generator.sh
SlackwareThis Forum is for the discussion of Slackware Linux.
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.
running a string as a command as it pertains to mkinitrd_command_generator.sh
I have a script I wrote that updates my kernels for all my machines whether they be bare metal, virtual, 32bit or 64bit. I am making some tweaks to it. I can run the the output mkinitrd_command_generator.sh as a command two different ways
I think the only real difference in this case is avoiding a subshell or not (and the quirks that come with subshells, e.g. setting a variable in a subshell isn't reflected in parent shell). Eval has the usual security concerns of passing unsanitized inputs to it, but in this case either should be fine.
I am mostly just wondering if there is a generally accepted "best practice" or if it doesn't matter.
No idea if there's a "generally accepted" answer, but my personal preference goes to the simplest solution. When I develop a script, I sometimes arrive at a solution that, while it does work, later on turns out to be far more complicated than it needs to be. To me, then, the simpler solution usually looks like the more elegant one, as well, and I tend to prefer it.
Not the answer you are asking for, but another solution is to just use the -c option and pipe it to /etc/mkinitrd.conf on the initial install once. Then you just need to run "mkinitrd -F -k $kernel_version" from then on.
Any particular reason you need to generate it fresh every time?
Not the answer you are asking for, but another solution is to just use the -c option and pipe it to /etc/mkinitrd.conf on the initial install once. Then you just need to run "mkinitrd -F -k $kernel_version" from then on.
Any particular reason you need to generate it fresh every time?
I use mkinitrd.conf on all my main machines, the mkinitrd_command_generator.sh is for throw away vm's.
Not at all, TBH honest I had forgot about it and I could change the script to do that. My script already checks for a minitrd.conf first and if it doesn't find it then it uses mkinitrd_command_generator.sh. It does make sense to create one but with throw away VM's mkinitrd_command_generator.sh is good enough.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.