Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/omamobile-omarchy/install
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# Stage omamobile-omarchy into DESTDIR. The pacman hook applies the patch
# series after the package transaction; the module-tree cleanup's timer is
# enabled by the wants link staged here, and Arch's linux-modules-cleanup is
# held off by a drop-in (lib/modules-cleanup says why).
# held off by a drop-in (lib/modules-cleanup says why). zram/91-omamobile.conf
# caps Omarchy's swap on zram at half the RAM.
# ./install DESTDIR
set -euo pipefail
cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
Expand All @@ -26,6 +27,7 @@ ln -sfn ../omamobile-modules-cleanup.timer "$u/timers.target.wants/omamobile-mod
for f in patches/*.patch; do
install -Dm644 "$f" "$d/usr/share/omamobile/omarchy/patches/${f##*/}"
done
install -Dm644 zram/91-omamobile.conf "$d/usr/lib/systemd/zram-generator.conf.d/91-omamobile.conf"
install -Dm644 libalpm/95-omamobile-omarchy-patches.hook "$d/usr/share/libalpm/hooks/95-omamobile-omarchy-patches.hook"
install -Dm644 LICENSE "$d/usr/share/licenses/omamobile-omarchy/LICENSE"
install -Dm644 LICENSE.omarchy "$d/usr/share/licenses/omamobile-omarchy/omarchy-MIT"
Expand Down
3 changes: 2 additions & 1 deletion packages/omamobile-omarchy/test/all
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fail() { printf 'not ok - %s\n' "$1" >&2; exit 1; }
pass() { printf 'ok - %s\n' "$1"; }

for f in install omamobile-omarchy.install lib/update-bin/* lib/lock-pam lib/modules-cleanup test/update.sh \
test/lock-pam.sh test/lock-glance test/sleep-lock.sh test/modules-cleanup.sh; do
test/lock-pam.sh test/lock-glance test/sleep-lock.sh test/modules-cleanup.sh test/zram.sh; do
bash -n "$f" || fail "$f parses"
done
for f in bin/omamobile-omarchy-patches bin/omamobile-update test/patches.py; do
Expand Down Expand Up @@ -63,6 +63,7 @@ if command -v systemd-analyze >/dev/null; then
fi
pass "install stages the module cleanup, its timer's wants link and the drop-in for Arch's"
bash test/modules-cleanup.sh || fail "modules-cleanup"
bash test/zram.sh || fail "zram drop-in"

# Every patch file says what it is for, before its first diff
for p in patches/*.patch; do
Expand Down
46 changes: 46 additions & 0 deletions packages/omamobile-omarchy/test/zram.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash
# SPDX-License-Identifier: MIT
# zram/91-omamobile.conf against Omarchy 4.5's drop-in: the staged file, and,
# when zram-generator is installed (or ZRAM_GENERATOR names it), the size it
# gives /dev/zram0 in a made-up root (ZRAM_GENERATOR_ROOT) with an 8 000 000 kB
# MemTotal. Nothing on this machine's zram is read or changed.
set -euo pipefail
cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.."
fail() { printf 'not ok - %s\n' "$1" >&2; exit 1; }
pass() { printf 'ok - %s\n' "$1"; }
t=$(mktemp -d); trap 'rm -rf "$t"' EXIT

./install "$t/stage" >/dev/null
f=$t/stage/usr/lib/systemd/zram-generator.conf.d/91-omamobile.conf
[[ -f $f ]] || fail "zram drop-in staged"
[[ $(grep -vE '^[[:space:]]*(#|$)' "$f") == $'[zram0]\nzram-size = ram / 2' ]] \
|| fail "zram drop-in sets only zram0's size, to half the RAM"
[[ 91-omamobile.conf > 90-omarchy.conf && 91-omamobile.conf < 99-local.conf ]] \
|| fail "zram drop-in sorts after Omarchy's and before a local one"
pass "the zram drop-in is staged and sets half the RAM"

gen=${ZRAM_GENERATOR:-/usr/lib/systemd/system-generators/zram-generator}
if [[ ! -x $gen ]]; then
pass "# SKIP zram-generator not installed: sizes not checked"
exit 0
fi
r=$t/root; d=$r/usr/lib/systemd/zram-generator.conf.d
mkdir -p "$d" "$r/proc" "$r/etc/systemd/zram-generator.conf.d"
printf 'MemTotal: 8000000 kB\nMemFree: 4000000 kB\n' > "$r/proc/meminfo"
: > "$r/proc/cmdline"
# Omarchy 4.5's default/systemd/zram-generator.conf.d/90-omarchy.conf.
printf '[zram0]\nzram-size = ram\ncompression-algorithm = zstd\nswap-priority = 100\n' > "$d/90-omarchy.conf"
size() {
rm -rf "$t/out"; mkdir "$t/out"
ZRAM_GENERATOR_ROOT=$r "$gen" "$t/out" 2>&1 | sed -n 's/.*\/dev\/zram0 with \([0-9]*\)MB.*/\1/p'
}
[[ $(size) == 7812 ]] || fail "zram-generator reads the made-up root (Omarchy alone: the whole RAM)"
cp "$f" "$d/"
[[ $(size) == 3906 ]] || fail "with the drop-in, zram0 is half the RAM"
grep -qx 'Priority=100' "$t/out/dev-zram0.swap" || fail "Omarchy's swap priority still applies"
# An /etc main file left from archinstall or an older Omarchy is outranked.
printf '[zram0]\nzram-size = ram\n' > "$r/etc/systemd/zram-generator.conf"
[[ $(size) == 3906 ]] || fail "a leftover /etc/systemd/zram-generator.conf doesn't undo it"
printf '[zram0]\nzram-size = 2048\n' > "$r/etc/systemd/zram-generator.conf.d/99-local.conf"
[[ $(size) == 2048 ]] || fail "a local 99-local.conf still decides"
pass "zram-generator: half the RAM over Omarchy's, a local drop-in still wins"
2 changes: 1 addition & 1 deletion packages/omamobile-omarchy/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.39
0.1.40
11 changes: 11 additions & 0 deletions packages/omamobile-omarchy/zram/91-omamobile.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Omarchy Mobile: swap on zram at half the RAM, not Omarchy's whole RAM.
# Omarchy's 90-omarchy.conf sets zram-size = ram. On the Pixel 9a (7.4 GB)
# that hung the phone under a 6 GB load until a restart, while ram / 2,
# stock Android's size there, took 5 GB more with no OOM kill and SSH still
# answering (device/tegu/NOTES.md, 2026-11-08). Drop-ins are read in name
# order across /usr/lib, /run and /etc, so this one, sorting after
# 90-omarchy.conf, sets the size and leaves Omarchy's other settings
# (zstd, the swap priority) alone. A local size goes in
# /etc/systemd/zram-generator.conf.d/99-local.conf, which sorts after this.
[zram0]
zram-size = ram / 2