wok-undigest diff linux/stuff/compcache @ rev 1257
recook binutils
author | Hans-Günter Theisgen |
---|---|
date | Sat Aug 13 10:55:58 2022 +0100 (2022-08-13) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/linux/stuff/compcache Sat Aug 13 10:55:58 2022 +0100 1.3 @@ -0,0 +1,47 @@ 1.4 +#!/bin/sh 1.5 +# /etc/init.d/compcache: Start, stop and restart COMPCACHE daemon on SliTaz, 1.6 +# at boot time or with the command line. Daemons options are configured 1.7 +# with /etc/daemons.conf 1.8 +# 1.9 +. /etc/init.d/rc.functions 1.10 +source /etc/compcache.conf 1.11 + 1.12 +NAME="compcache" 1.13 +DESC="$(_ '%s daemon' compcache)" 1.14 +EXIST=$(cat /proc/swaps | grep zram0) 1.15 + 1.16 +case "$1" in 1.17 + start) 1.18 + if [ -n "$EXIST" ] ; then 1.19 + _ '%s is already running.' $NAME 1.20 + exit 1 1.21 + fi 1.22 + action 'Loading module...' 1.23 + modprobe zram zram_num_devices=1 && 1.24 + [ -n "$SIZE_KB" ] && echo $(($SIZE_KB * 1024)) > /sys/block/zram0/disksize 1.25 + status 1.26 + 1.27 + action 'Starting %s: %s...' "$DESC" $NAME 1.28 + mkswap /dev/zram0 && swapon /dev/zram0 -p 100 1.29 + status 1.30 + ;; 1.31 + stop) 1.32 + if [ -z "$EXIST" ] ; then 1.33 + _ '%s is not running.' $NAME 1.34 + exit 1 1.35 + fi 1.36 + action 'Stopping %s: %s...' "$DESC" $NAME 1.37 + swapoff /dev/zram0 && echo 1 > /sys/block/zram0/reset 1.38 + status 1.39 + action 'Unloading module...' 1.40 + rmmod zram 1.41 + status 1.42 + ;; 1.43 + *) 1.44 + emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop]" 1.45 + newline 1.46 + exit 1 1.47 + ;; 1.48 +esac 1.49 + 1.50 +exit 0