feat(dbus): Add dphys-swapfile configuration functionality
Implemented `configure_dphys_swapfile` to manage the dphys-swapfile service, including automatic swapfile removal when the service is disabled. Updated feature registry to support dphys-swapfile configuration.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# SPDX-FileCopyrightText: 2025 KUNBUS GmbH
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
import subprocess
|
||||
from enum import Enum, IntEnum
|
||||
from logging import getLogger
|
||||
from os import X_OK, access
|
||||
@@ -105,6 +106,21 @@ def configure_avahi_daemon(action: ConfigActions):
|
||||
return return_value
|
||||
|
||||
|
||||
def configure_dphys_swapfile(action: ConfigActions):
|
||||
return_value = simple_systemd(action, "dphys-swapfile.service")
|
||||
|
||||
# Post actions for dphys-swapfile
|
||||
if action is ConfigActions.DISABLE:
|
||||
# Remove swapfile afer disabling the service unit
|
||||
subprocess.call(
|
||||
["/sbin/dphys-swapfile", "uninstall"],
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL,
|
||||
)
|
||||
|
||||
return return_value
|
||||
|
||||
|
||||
def configure_gui(action: ConfigActions):
|
||||
gui_available = access("/usr/bin/startx", X_OK)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user