[ar71xx] fix dir-825-b1 default network config after r21905
[openwrt.git] / package / compcache / files / compcache.init
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 lzo1x
22 insmod ramzswap $params_set
23 swapon /dev/ramzswap0
24 fi
25 fi
26 fi
27 }
28
29 remove_modules() {
30 local section="$1"
31 config_get_bool "enabled" "$section" "enabled" '1'
32 if [ "$enabled" -gt 0 ]; then
33 [ "`cat /proc/swaps | grep 'ramzswap0'`" != "" ] && swapoff /dev/ramzswap0
34 [ "`lsmod | grep 'ramzswap'`" != "" ] && rmmod ramzswap &> /dev/null
35 [ "`lsmod | grep 'lzo1x'`" != "" ] && rmmod lzo1x &> /dev/null
36 fi
37 }
38
39 start() {
40 config_load "compcache"
41 config_foreach load_modules "compcache"
42 }
43
44 stop() {
45 config_load "compcache"
46 config_foreach remove_modules "compcache"
47 }
This page took 0.062456 seconds and 5 git commands to generate.