summaryrefslogtreecommitdiff
path: root/config-parabola-mgmt-swap.PKGBUILD
diff options
context:
space:
mode:
Diffstat (limited to 'config-parabola-mgmt-swap.PKGBUILD')
-rw-r--r--config-parabola-mgmt-swap.PKGBUILD35
1 files changed, 35 insertions, 0 deletions
diff --git a/config-parabola-mgmt-swap.PKGBUILD b/config-parabola-mgmt-swap.PKGBUILD
new file mode 100644
index 0000000..9474e84
--- /dev/null
+++ b/config-parabola-mgmt-swap.PKGBUILD
@@ -0,0 +1,35 @@
+. ${BUILDFILE%/*}/common.sh
+pkgver=20180826
+
+package() {
+preamble
+
+# we want z3fold compression from 4.7
+depends=(systemd-swap 'LINUX-ABI_VERSION>=4.7')
+conflicts=('LINUX-ABI_VERSION<4.7')
+
+# In addition to what's configured in fstab, we use systemd-swap to
+# manage advanced swap devices. There are 3 things we enable in
+# systemd-swap:
+#
+# - zswap: compress pages on disk
+# - zram: compress pages in RAM
+# - swapfc: in emergencies, allocate space in the filesystem to swap
+# to
+add-file -m755 usr/share/holo/files/10-"$pkgname"/etc/systemd/swap.conf.holoscript <<EOF
+#!/bin/sh
+sed '
+ s/^# Zswap\$/& (compress pages on disk)/
+ s/zswap_enabled=.*/zswap_enabled=1/
+
+ s/^# ZRam\$/& (compress pages in RAM)/
+ s/zram_enabled=.*/zram_enabled=1/
+
+ s/swapfc_enabled=.*/swapfc_enabled=1/
+' | awk '\$0==""||!x[\$0]++'
+EOF
+
+add-unit etc/systemd/system/local-fs.target.wants/systemd-swap.service
+
+postamble
+}