pmaports/main/postmarketos-base/postmarketos-base.post-install
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

31 lines
737 B
Bash

#!/bin/sh -e
# Enable eudev service
rc-update add udev sysinit
rc-update add udev-trigger sysinit
rc-update add udev-settle sysinit
rc-update add udev-postmount default
# Enable other OpenRC services
for service in devfs dmesg; do
rc-update -q add $service sysinit
done
for service in hwclock modules sysctl hostname bootmisc syslog; do
rc-update -q add $service boot
done
for service in sshd swapfile local zram-init; do
rc-update -q add $service default
done
for service in mount-ro killprocs savecache; do
rc-update -q add $service shutdown
done
# Prime swclock with a reasonable date/time on first boot
mkdir -p /run/openrc
touch /run/openrc/shutdowntime
# Make apk interactive by default
touch /etc/apk/interactive
exit 0