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.
I've been using rc.firewall (from Projectfiles.com). So with Slackware 14 it spits out that error and I've decided to use 'lsmod' instead of lsmod -l in the line:
Code:
if (( `modprobe -l | grep -c "$MODULE"` )); then
I hope that's fine, but I do think that there are some other changes that came in with new kernel. So should I abandon the script and look somewhere else, since there might be other changes in iptables that are not available in the latest stable.
Anybody else still using the firewall from projectfiles?
You could always use lsmod, that would be slightly more elegant than Didier's solution.
"lsmod" only list loaded modules. Instead, "modprobe -l" (did) list all modules, be they loaded or not and the solution I proposed do the same. So they are not equivalent.
Last edited by Didier Spaier; 10-01-2012 at 12:48 AM.
Reason: "Instead," added
I've been using rc.firewall (from Projectfiles.com). So with Slackware 14 it spits out that error and I've decided to use 'lsmod' instead of lsmod -l in the line:
Code:
if (( `modprobe -l | grep -c "$MODULE"` )); then
I hope that's fine
No, that's not fine.
I suppose you are thinking about making the replacement in this code snippet (from line #1189):
Code:
for MODULE in $REQUIRED_MODULES; do
if (( `modprobe -l | grep -c "$MODULE"` )); then
modprobe $MODULE > /dev/null 2>&1
fi
done
So replacing "modprobe -l" with "lsmod" would have the effect of only loading modules that are already loaded, which was certainly not intended by the author. Furthermore as the script date back 2006 the list of modules in $REQUIRED_MODULES should most probably be updated.
"lsmod" only list loaded modules. Instead, "modprobe -l" (did) list all modules, be they loaded or not and the solution I proposed do the same. So they are not equivalent.
Thanks for catching my mistake. I wonder why they got rid of modprobe -l when there is obviously a need for it?
I wonder why they got rid of modprobe -l when there is obviously a need for it?
Because it's easy enough to replace with a "find" command, as shown above. In previous "man modprobe" it was suggested to use "find" and "basename" instead. Let's do that (I suppose you want to list only the modules' names, without their paths):
Code:
for i in $(find /lib/modules/$(uname -r)/ -type f -name "*ko"); do basename $i; done
Proposing a simpler solution is left as an exercise .
EDIT Nostalgia? Add following line to your ~/.bashrc
Code:
alias ls-l='for i in $(find /lib/modules/$(uname -r)/ -type f -name "*ko"); do basename $i; done'
Then fire up a terminal and type:
Code:
ls-l
Last edited by Didier Spaier; 10-01-2012 at 05:08 AM.
Reason: EDIT added
Because it's easy enough to replace with a "find" command, as shown above. In previous "man modprobe" it was suggested to use "find" and "basename" instead. Let's do that:
So instead of simple spawning "modporbe -l" from my C code I forced to spawn shell(which can be absent)? I don't think I shall like it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.