summaryrefslogtreecommitdiff
path: root/config-mgmt-swap.PKGBUILD
blob: 6d0492b7c9ae9e5c7f928e0b50ebd6a30a8ddaec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
. ${BUILDFILE%/*}/common.sh
pkgver=20170204

package() {
preamble

depends=(systemd-swap)

add-file -m755 usr/share/holo/files/10-"$pkgname"/etc/systemd/swap.conf.holoscript <<EOF
#!/bin/sh
sed '
	s/^# Zswap$/& (compress pages on disk)/
	/zswap_zspool=z3fold/ {
		a# The systemd-swap default '\''z3fold'\'' was added in Linux 4.7; because we
		a# are running an -lts kernel, we'\''re still on 4.4, so we fall back to
		a# zbud.
		azswap_zpool=zbud
	}

	/^# ZRam/s/.*/& (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
}