This is meant to replace zram-init. It's much simpler, since it only sets up zram swap and doesn't try to do all the things that zram-init does. This also lets us add additional logic, such as selecting different default algorithms based on the runtime CPU arch and conditionally applying sysctl settings that might be inappropriate when *not* using zram swap. To create zramstart, I took the zram-configurator, which reads config from deviceinfo vars, and extended it to create the zram swap device. zramstart and zramstop were inspired by what Fedora does. The sysctl config is from the work done here: https://source.puri.sm/Librem5/librem5-base/-/merge_requests/381 Signed-off-by: Clayton Craft <craftyguy@postmarketos.org> Part-of: <https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/7754>
6 lines
171 B
Bash
6 lines
171 B
Bash
#!/bin/sh
|
|
|
|
for i in $(grep '^/dev/zram' /proc/swaps | awk '{ print $1 }'); do
|
|
swapoff "$i" && zramctl --reset "$i"
|
|
echo "Stopped ZRAM swap device $i"
|
|
done
|