View Single Post
Posts: 1,101 | Thanked: 1,185 times | Joined on Aug 2008 @ Spain
#102
Originally Posted by lma View Post
BTW, that's fixable, and I'm thinking of adding it to the community SSU. Here's a ramzez-init modification to handle both cases (as well as getting rid of a (harmless) "sh: : unknown operand" error when disksize isn't set in GConf, and simplifying the insmod logic a bit):
Your modification doesn't work because swapon is busybox.
This works, it's already included in the diablo-tweaks package, in the "diabloturbo" thread.
Code:
--- ramzez-init 2009-10-02 12:45:40.000000000 +0200
+++ /etc/init.d/ramzez-init     2010-07-24 15:22:01.000000000 +0200
@@ -19,17 +19,21 @@
        echo "Inserting kernel modules!"
        DISKSIZE_KB=$(gconftool-2 -g /apps/ramzez/disksize)
        insmod /usr/share/ramzez/xvmalloc.ko
-       if [[ $DISKSIZE_KB != '' ]]; then
+       if [[ "$DISKSIZE_KB" != "" ]]; then
                insmod /usr/share/ramzez/ramzswap.ko disksize_kb=$DISKSIZE_KB        else
                insmod /usr/share/ramzez/ramzswap.ko disksize_kb=$DISKSIZE_DEFAULT
        fi
        sleep 1
-       swapon /dev/ramzswap0
+       /sbin/swapon /dev/ramzswap0
+       for i in $(grep -v ramzswap /proc/swaps|grep -v Filename|cut -d " " -f 1); do
+               /sbin/swapoff "$i"
+               /sbin/swapon "$i"
+       done
        ;;
   stop)
        echo "Removing kernel modules!"
-       swapoff /dev/ramzswap0
+       /sbin/swapoff /dev/ramzswap0
        rmmod ramzswap
        rmmod xvmalloc
        ;;