ZRAM config: suppress errors when kernel support is not there

This commit is contained in:
Igor Pecovnik
2025-03-27 12:19:05 +01:00
committed by Igor
parent e4c7d24229
commit 56b773cf8a

View File

@@ -25,6 +25,8 @@ ENABLED=false
[ -f /etc/default/armbian-zram-config ] && . /etc/default/armbian-zram-config
# Exit if not Enabled
[[ "$ENABLED" != "true" ]] && exit 0
# Exit if module not Loaded
if ! modinfo "zram" 2>/dev/null; then exit 0; fi
# Do not interfere with already present zram-config package
dpkg -l | grep -q 'zram-config' && exit 0
@@ -60,7 +62,7 @@ activate_zram_swap() {
# swap file or partition on *capable* storage needs to be chosen and
# defined as swap and also in /etc/default/armbian-zram-config SWAP=false
# needs to be set.
echo 0 >/sys/module/zswap/parameters/enabled 2>/dev/null
[[ -f /sys/module/zswap/parameters/enabled ]] && echo 0 >/sys/module/zswap/parameters/enabled
# Limit Journal size to 20Mb
sed -i "s/.*SystemMaxUse=$/SystemMaxUse=20M/" /etc/systemd/journald.conf