[linux-mm-cc] [patch] make use_compcache.sh know udevsettle

Nai Xia nai.xia at gmail.com
Sun Apr 13 06:01:34 EDT 2008


Hi, this patch makes the use_compcache.sh compatible with udevsettle
(It seems debian sid doesn't have udevadm) and even with the system
without both of them (rare).

diff --git a/use_compcache.sh b/use_compcache.sh
index 96810ff..3778eda 100755
--- a/use_compcache.sh
+++ b/use_compcache.sh
@@ -15,7 +15,9 @@ LSMOD_BIN=/sbin/lsmod
 INSMOD_BIN=/sbin/insmod
 MODPROBE_BIN=/sbin/modprobe
 SWAPON_BIN=/sbin/swapon
-UDEVADM_BIN=/sbin/udevadm
+UDEV_TIMEOUT=10
+
+

 INSMOD()
 {
@@ -47,7 +49,19 @@ INSMOD compcache

 # /dev/ramzswap0 is not available immediately after insmod returns
 # So, let udev complete its work before we do swapon
-$UDEVADM_BIN settle
+
+
+if [ -x /sbin/udevadm ]; then
+       /sbin/udevadm settle
+elif [ -x /sbin/udevsettle ]; then
+       /sbin/udevsettle
+else
+       for((i=0;i<"$UDEV_TIMEOUT";i++)); do
+               [ -b /dev/ramzswap0 ] && break
+               sleep 1
+       done
+fi
+

 # Set it as swap device with highest priority
 EXIST=`cat /proc/swaps | grep compcache`


More information about the linux-mm-cc mailing list