diff options
Diffstat (limited to 'zram.init')
-rwxr-xr-x | zram.init | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/zram.init b/zram.init new file mode 100755 index 000000000000..e3717951bacf --- /dev/null +++ b/zram.init @@ -0,0 +1,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 +} |