summaryrefslogtreecommitdiffstats
path: root/sbin/init.d/functions
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/init.d/functions')
-rwxr-xr-xsbin/init.d/functions22
1 files changed, 10 insertions, 12 deletions
diff --git a/sbin/init.d/functions b/sbin/init.d/functions
index cc4058e..4d1be02 100755
--- a/sbin/init.d/functions
+++ b/sbin/init.d/functions
@@ -1,7 +1,7 @@
#!/bin/bash
#
-# sbin/init.d/functions - Formilux init script - version 0.3.24 - 2003-10-02
+# sbin/init.d/functions - Formilux init script - version 0.3.31 - 2004-03-11
#
# Copyright (C) 2001-2003 Benoit Dolez & Willy Tarreau
# mailto: benoit@ant-computing.com,willy@ant-computing.com
@@ -215,18 +215,10 @@ function recursive_rmmod {
local mod
while : ; do
- args=( $(/sbin/lsmod|grep "^$1 "|tr -d '\[\]') )
+ args=( $(/sbin/lsmod|tail +2|sed "s/([^)]*)//g"|grep "^$1 "|tr -d '\[\]') )
[ ${#args[@]} -gt 0 ] || return 0
- if [ "${args[2]}" = "0" ]; then
- rmmod $1
- return $?
- elif [ -z "${args[3]}" ]; then
- # use count >0, but nothing to unload
- return 1
- elif [ "${args[3]}" = "(autoclean)" ]; then
- # use count >0, but nothing to unload
- return 1
- else
+ if [ -n "${args[3]}" ]; then
+ # there are modules to unload first
mod=3
while [ $mod -lt ${#args[@]} ]; do
if ! recursive_rmmod ${args[$mod]}; then
@@ -235,6 +227,12 @@ function recursive_rmmod {
fi
(( mod++ ))
done
+ elif [ "${args[2]}" = "0" ]; then
+ rmmod $1
+ return $?
+ else
+ # impossible to remove this module (count>0)
+ return 1
fi
done
}