jw.pkg.cmds.distro.CmdRebootRequired: Add class

Add the command distro.CmdRebootRequired, adding support for "distro
reboot-required". The command exits with status code 1 if a reboot is
required and 0 otherwise.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-03-03 07:15:48 +01:00
commit 79d40af558
4 changed files with 85 additions and 0 deletions

View file

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from argparse import Namespace, ArgumentParser
from .Cmd import Cmd
from ..CmdDistro import CmdDistro
class CmdRebootRequired(Cmd): # export
def __init__(self, parent: CmdDistro) -> None:
super().__init__(parent, 'reboot-required', help="Check whether the machine needs rebooting")
def add_arguments(self, parser: ArgumentParser) -> None:
super().add_arguments(parser)
parser.add_argument('--verbose', default=False, action='store_true', help='Be chatty about the check')
async def _run(self, args: Namespace) -> None:
return await self._backend.run(args)