[xburst] Add missing symbol to 2.6.35 config
[openwrt.git] / package / compcache / files / compcache.init.new
1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2008 OpenWrt.org
3 START=14
4
5 load_modules() {
6 local section="$1"
7 config_get "size_kbytes" "$section" "size_kbytes"
8 config_get "backup_dev" "$section" "backup_dev"
9 #CC_PARAM_STR="memlimit_kb=$1 backing_dev=$BACKING_DEV"
10 config_get_bool "enabled" "$section" "enabled" '1'
11 if [ "$enabled" -gt 0 ]; then
12 if [ "`cat /proc/swaps | grep 'ramzswap0'`" != "" ]; then
13 echo "compcache already loaded"
14 else
15 if [ "$backup_dev" != "" ]; then
16 params_set="memlimit_kb=$size_kbytes backing_swap=$backup_dev"
17 else
18 params_set="disksize_kb=$size_kbytes"
19 fi
20 if [ "`lsmod | grep 'ramzswap'`" == "" ]; then
21 insmod lzo_compress
22 insmod lzo_decompress
23 insmod ramzswap $params_set
24 sleep 2
25 swapon /dev/ramzswap0
26 fi
27 fi
28 fi
29 }
30
31 remove_modules() {
32 local section="$1"
33 config_get_bool "enabled" "$section" "enabled" '1'
34 if [ "$enabled" -gt 0 ]; then
35 [ "`cat /proc/swaps | grep 'ramzswap0'`" != "" ] && swapoff /dev/ramzswap0
36 [ "`lsmod | grep 'ramzswap'`" != "" ] && rmmod ramzswap &> /dev/null
37 [ "`lsmod | grep 'lzo_compress'`" != "" ] && rmmod lzo_compress &> /dev/null
38 [ "`lsmod | grep 'lzo_decompress'`" != "" ] && rmmod lzo_decompress &> /dev/null
39 fi
40 }
41
42 start() {
43 config_load "compcache"
44 config_foreach load_modules "compcache"
45 }
46
47 stop() {
48 config_load "compcache"
49 config_foreach remove_modules "compcache"
50 }
This page took 0.049548 seconds and 5 git commands to generate.