From 1a030f0ff7f4787b4334c0f4fde7b8e56056178d Mon Sep 17 00:00:00 2001 From: Aaron Ball Date: Fri, 21 May 2021 13:48:24 -0600 Subject: Move zram modprobe to top of main Both the status and start commands require the zram module to be loaded, so this should resolve any module loading issues. --- zram-swap | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/zram-swap b/zram-swap index 90bda43..0041234 100755 --- a/zram-swap +++ b/zram-swap @@ -38,9 +38,6 @@ start() { # Thread count is half of cpu local threads="$(( $(nproc) / 2 ))" - # Make sure the zram module is loaded - modprobe zram - # Create the zram device zramctl "${unused}" -s "${size}" -t "${threads}" mkswap "${unused}" @@ -54,8 +51,6 @@ stop() { swapoff ${zram} zramctl -r "${zram}" rm -f "${RUNFILE}" - # Note: We do not want to try to remove the zram kernel module in case other - # devices are in use. } main() { @@ -64,6 +59,9 @@ main() { return 1 fi + # Make sure the zram module is loaded + modprobe zram + if [ "${1:-}" = 'start' ]; then start elif [ "${1:-}" = 'stop' ]; then -- cgit v1.2.3