From b1d8f9282da80144a782328cdd535dea0afb84d3 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 14 Mar 2018 16:41:25 +0100 Subject: scripts/functions: make recursive_rmmod also support kmod With modules handled by kmod, "lsmod" emits dependencies list using a comma as the delimitor instead of a space, breaking recursive_rmmod's ability to properly remove all modules. Let's support the comma as well. --- sbin/init.d/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/init.d/functions b/sbin/init.d/functions index 0c7a441..fde3615 100755 --- a/sbin/init.d/functions +++ b/sbin/init.d/functions @@ -335,7 +335,7 @@ recursive_rmmod() { [ -e /proc/modules ] || return 0 while : ; do - args=( $(/sbin/lsmod|tail -n +2|sed "s/([^)]*)//g"|grep "^$1 "|tr -d '\[\]') ) + args=( $(/sbin/lsmod|tail -n +2|sed "s/([^)]*)//g"|grep "^$1 "|tr -d '\[\]'|tr ',' ' ') ) [ ${#args[@]} -gt 0 ] || return 0 if [ -n "${args[3]}" ]; then # there are modules to unload first -- 2.8.0.rc2.1.gbe9624a