summarylogtreecommitdiffstats
path: root/zram.init
blob: e3717951bacfb63dd9c1a1105b2235e0c450b1f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/openrc-run
# Copyright 2021 Doletov Fyodor

description="Enable zram"

depend() {
    need sysfs
}

start(){
    modprobe zram
    echo "$comp_algorithm" > /sys/block/zram0/comp_algorithm
    echo "$zram_size" > /sys/block/zram0/disksize
    ebegin $(mkswap --label zram0 /dev/zram0)
    swapon --priority 100 /dev/zram0
}

stop(){
    swapoff /dev/zram0
    rmmod zram
}