first commit

This commit is contained in:
julien
2026-03-15 19:58:46 +01:00
commit bbc4e4da65
32 changed files with 1854 additions and 0 deletions

30
roles/zram/config.sh Executable file
View File

@@ -0,0 +1,30 @@
#!/usr/bin/env bash
source "${PROJECT_DIR:?}/lib.sh"
enable_strict_mode
cat <<'EOM'
=> ZRAM
EOM
ZFILE="/etc/default/zramswap"
if [[ ! -f "$ZFILE" ]]; then
write_text_file_if_changed $'# Configuration minimale pour zramswap\nALGO=zstd\nPERCENT=50\n' "$ZFILE" >/dev/null || true
fi
if grep -q '^ALGO=lz4' "$ZFILE" 2>/dev/null; then
sed -i 's/^ALGO=lz4/ALGO=zstd/' "$ZFILE"
elif ! grep -q '^ALGO=' "$ZFILE" 2>/dev/null; then
echo 'ALGO=zstd' >>"$ZFILE"
fi
if ! grep -q '^PERCENT=' "$ZFILE" 2>/dev/null; then
echo 'PERCENT=50' >>"$ZFILE"
fi
restart_service_if_present zramswap
if ! systemctl is-active --quiet zramswap.service; then
echo 'Warning: zramswap.service not active' >&2
fi

3
roles/zram/packages.list Normal file
View File

@@ -0,0 +1,3 @@
ROLE_PACKAGES=(
"zram-tools"
)