pmaports/main/postmarketos-base/APKBUILD
Clayton Craft bca632d4f6
postmarketos-base: enable using zram swap by default (MR 3752)
This installs zram-init and sets it to start on boot for all
devices/UIs. The included conf.d/zram-init also allows diabling using
zram swap or overriding the size by using a deviceinfo var.

I did an analysis of the pmos base install size with the 'none' UI
selected, after depending on zram-init, and the following new package is
installed:
        zram-init-11.1-r1 installed size: 40 KiB

These packages are dependencies of zram-init, however they are already
installed in the base image (with 'none' UI) so they are not counted
above:
        util-linux-misc-2.38.1-r0 installed size: 6816 KiB
        e2fsprogs-extra-1.46.5-r4 installed size: 1324 KiB

So this seems like a very small price to pay for the benefit of not
making the logic/implementation more complicated than this.

     * Starting busybox syslog ... [ ok ]
    ssh-keygen: generating new host keys: RSA ECDSA ED25519
     * Starting sshd ... [ ok ]
    zram swap: activating with size: 243 MB
     * Loading zram module...
     [ ok ]
     * Swap->zram0
     [ ok ]
     * Starting local ... [ ok ]

This change introduces one new deviceinfo variable:
deviceinfo_zram_swap_pct: percentage of RAM to use for zram swap

Default percentages if the second var is unset are explained in the
zram-init file this commit adds. A value of 0 disables zram swap.

fixes #1133
2023-01-11 15:39:40 +01:00

144 lines
5.7 KiB
Text

pkgname=postmarketos-base
pkgver=25
pkgrel=0
pkgdesc="Meta package for minimal postmarketOS base"
url="https://postmarketos.org"
arch="noarch"
license="GPL-3.0-or-later"
depends="
alpine-base
eudev
openssh
postmarketos-mkinitfs
postmarketos-mvcfg
postmarketos-keys
cmd:sudo
zram-init
"
install="$pkgname.post-install $pkgname.pre-upgrade $pkgname.post-upgrade"
triggers="$pkgname.trigger=/etc"
subpackages="
$pkgname-mesa
$pkgname-nftables
$pkgname-nofde
"
options="!check"
# alpine-base and busybox-initscripts can be removed from here after 23.01 is out
replaces="
alpine-base
alpine-baselayout
alpine-baselayout-data
alpine-release
busybox-initscripts
busybox-openrc
openrc
sudo
zram-init-openrc
"
replaces_priority=100 # leave plenty for alpine
_source440="
etc/sudoers
etc/doas.d/10-postmarketos.conf
"
_source644="
etc/conf.d/bootmisc
etc/conf.d/swapfile
etc/conf.d/zram-init
etc/conf.d/syslog
etc/fstab
etc/issue
etc/motd
etc/os-release
etc/sysctl.d/disable-rp-filter.conf
lib/udev/rules.d/20-tm2-touchkey-input.rules
lib/udev/rules.d/20-tm2-touchkey-leds.rules
lib/udev/rules.d/20-zinitix-input.rules
lib/udev/rules.d/50-firmware.rules
usr/lib/udev/rules.d/90-feedbackd-regulator-haptic.rules
"
_source755="
etc/init.d/deferred-initcalls
etc/init.d/swapfile
sbin/swapfile
usr/lib/firmwareload.sh
"
# Avoid filename based checksum conflicts by including the whole path:
# https://gitlab.alpinelinux.org/alpine/abuild/-/issues/10013
flatpath() {
local i
for i in $@; do
echo "rootfs-$i" | sed s./.-.g
done
}
source="$(flatpath $_source440 $_source644 $_source755)"
prepare() {
default_prepare
# setterm -powersave on -blank 5
echo -ne "\033[9;5]" >> rootfs-etc-issue
}
package() {
local i
for i in $_source440; do
install -Dm440 "$srcdir/$(flatpath "$i")" "$pkgdir/$i"
done
for i in $_source644; do
install -Dm644 "$srcdir/$(flatpath "$i")" "$pkgdir/$i"
done
for i in $_source755; do
install -Dm755 "$srcdir/$(flatpath "$i")" "$pkgdir/$i"
done
postmarketos-mvcfg-package "$pkgdir" "$pkgname"
}
mesa() {
replaces=""
depends="mesa-dri-gallium"
install_if="$pkgname=$pkgver-r$pkgrel mesa"
mkdir "$subpkgdir"
}
nftables() {
install_if="$pkgname=$pkgver-r$pkgrel nftables"
depends="postmarketos-config-nftables"
install="$subpkgname.post-install"
mkdir "$subpkgdir"
}
nofde() {
# dummy package that satisfies the unlocker dependency for mkinitfs without
# installing anything for systems that don't use fde
provides="postmarketos-fde-unlocker"
provider_priority=1
mkdir "$subpkgdir"
}
sha512sums="
e529f5cef1f31481b577f99b8917704f2cfefb963d98bf40a14b017938e55a00134d2033f81d2cb0b8489c5e9b4a92fdc0a788013f1adb4cd46d9580c9988186 rootfs-etc-sudoers
9591c9cb2194fa1092505159c9eb3d899bec95b6dbd9a0222be62098db012da113a125e40d70373d60af9880dfa489bdbe12b6b897bdef5613e023800fb6ee1b rootfs-etc-doas.d-10-postmarketos.conf
a5c6bfaf6ee41f9623f463b64dab95924453d7b70bdd114cc441be9fc68fb6b0e042ae3163ec357d0dd6db93767232224b8c03df29f2cadf3ac2c6e2c998784f rootfs-etc-conf.d-bootmisc
e0d2d48b82a03239a4c0a00acaf83e00d397c23a8d7c71053d4e2a383357c22dcedef9e81b0e12a1d7514e1fdbe0bb3eb82613d18b29034a7ce5447f13c84a53 rootfs-etc-conf.d-swapfile
488440c14ff7a662a6a0e5cad9caed1a972f82d2361b4985a68c3f05fab0a3fe9c58887907e66f683c8f8b6c12ba7e17cafdec1aa72cd9055190bd9f7a14c888 rootfs-etc-conf.d-zram-init
e4576c58c35f80bedddb1e89e186f37d31a186d3e9eb046581b8c5d7b7d435e18924539e851d3e67dc0ede80f9d44d16bd9ef52e73350d3f13224edc31d73a34 rootfs-etc-conf.d-syslog
9b8d0493bb64457fe176fea801e0771d3c5279302c61559824bf81b3d2b66d2c1e076f4aaac65f55389005acb18c27e44bed858c2bdbad37d74199f07c86c354 rootfs-etc-fstab
45bd0742a64a9d3c4a88e152b97edcf3fa1edca28884f9ea69e7c4c365f1e41ef9056dbe204545de7d4b2ba92e1e5872b2a929c2dcc1dd468e627cc3f090b8e6 rootfs-etc-issue
01403df3b5a2be0dd70387a3c32cf24a77bc097679fbefca585082a0970b7d756723c33687be3809351b5e31c85947db84861118bfeced8f5f865fe2452555ec rootfs-etc-motd
093c201f0c7aa203df447f2a8c27e5834520a7016ce2934ddc35fb037d2ec9acf0f7df7c06e07ad24ba7b4d94ef21fe7ff848c58bd62277eeeb08659fbddf1e9 rootfs-etc-os-release
b70ee1b39b5f33c9a3e6bf4259158519691c82c8cefb700d4df49eb749a2cce208082e00d4905b9eea2c4f75b6da62f73931931c92157b4132adb35dcf0e0a6f rootfs-etc-sysctl.d-disable-rp-filter.conf
01e042b5433a042d5100e21835c165866be14707f5c6ac7a857ec33e43ce40f470183d36a8e9ad201e00d9630b235f02dc00b3abcc1f25f814bc01c58c8f07e3 rootfs-lib-udev-rules.d-20-tm2-touchkey-input.rules
de4d8f258cb2ce654be15abe0188caa6ca9cc163fd45350f2025e7e9d043878e3f1202ef9033b1b15d7e18c4b40c3b19db387ee050a3baf03c4bd4293f4721e3 rootfs-lib-udev-rules.d-20-tm2-touchkey-leds.rules
1972174b97a99bcc58e87b3e093bdef260054f6aee1c1c345842a53991c2d5faf1b1ebc3c97f9dcf230f4d73ec06e27bf8ca3776527f999e3fd95877ff66d25b rootfs-lib-udev-rules.d-20-zinitix-input.rules
0b098828080055d3646ea54891cb0e1b578cbc30f5e16f7284f2814c08192f18079a38fb686d192715ae6a3d2cd6625d9e3cf99f234a6f0d94088bb0cb2ce43d rootfs-lib-udev-rules.d-50-firmware.rules
f5c6913040a0448c346fdd0b5dbea865a3ac92ac1a21646d32753e6521642a27b061c314f10a14b612b78aa6bc8d3209e51f7ced95c478f1be55e478ff04067b rootfs-usr-lib-udev-rules.d-90-feedbackd-regulator-haptic.rules
5fd6dd7f9941e975a6ce559924eb252606943276dc09455bbeb05ff718ecd28f20a08eee8e04ca580e5af71d4c944c256ec04f07b07286394f5dfedfa59273e7 rootfs-etc-init.d-deferred-initcalls
f5cc0f1265955d2646e5f099dd4b5d4c287945bfc18c16044db57670d456f55c678fc11cc59e6dab3fa340832ce869d516302a3a35c13518539ed0cedca51819 rootfs-etc-init.d-swapfile
3ceeee37f558e7c95ad973692b6a437f997e6b46c3d1c2257ddfb1529a5633477373aa123c7f08164e818daae50acb203d151379f27ca11bd458809e6a0d4de7 rootfs-sbin-swapfile
72c73bd67bfe2a659c469781e4def038a9b2482e014c0304150fbc25c5325fc7a36b288de76447837741bb9a828eb1db6df0d33b41cf67c7a25bb27b03777b1f rootfs-usr-lib-firmwareload.sh
"