aboutsummaryrefslogtreecommitdiffstats
path: root/iurt_root_command
diff options
context:
space:
mode:
authorMichael Scherer <misc@mageia.org>2011-04-15 13:52:00 +0000
committerMichael Scherer <misc@mageia.org>2011-04-15 13:52:00 +0000
commit5de4abb8ee322352c9b9fafad9068a0f74c51470 (patch)
tree50254769f0711cbfc7b64efae24c59af095f4714 /iurt_root_command
parent91c573f2ad0609ab55e7359ac431d373c02488fc (diff)
downloadiurt-5de4abb8ee322352c9b9fafad9068a0f74c51470.tar
iurt-5de4abb8ee322352c9b9fafad9068a0f74c51470.tar.gz
iurt-5de4abb8ee322352c9b9fafad9068a0f74c51470.tar.bz2
iurt-5de4abb8ee322352c9b9fafad9068a0f74c51470.tar.xz
iurt-5de4abb8ee322352c9b9fafad9068a0f74c51470.zip
- do not harcode module name, use a better regexp and shorter line to check if the module is already loaded
Diffstat (limited to 'iurt_root_command')
-rwxr-xr-xiurt_root_command9
1 files changed, 3 insertions, 6 deletions
diff --git a/iurt_root_command b/iurt_root_command
index 9db3404..8a27a39 100755
--- a/iurt_root_command
+++ b/iurt_root_command
@@ -203,12 +203,9 @@ sub modprobe {
plog("ERROR: unauthorized module $module");
return 0;
}
- open my $modules, '/proc/modules';
- while (my $m = <$modules>) {
- if ($m =~ /unionfs/) {
- return 1;
- }
- }
+
+ return 1 if grep { /^$module\b/ } read_file("/proc/modules");
+
system("/sbin/depmod", "-a");
!system("/sbin/modprobe", "-f", $module);
}