#!/bin/sh

po_domain="alterator-zram-swap"
alterator_api_version=1

. alterator-sh-functions

on_message() {
  case "$in_action" in
    read)
        write_bool_param zram_state "$((/sbin/systemctl --quiet is-enabled zram-swap && echo Yes) || echo No)"
        ;;
    write)
        case "$in_zram_state" in 
            "#t") /sbin/systemctl --now enable zram-swap ;;
            "#f") /sbin/systemctl --now disable zram-swap ;;
        esac
        ;;
    list)
        ;;
  esac
}

message_loop
