commands: move shutdown command to pmb/commands (MR 2252)

Another one bites the dust

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
Caleb Connolly 2024-06-09 07:36:41 +02:00 committed by Oliver Smith
parent a99ae02068
commit 656ff3f5bb
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
3 changed files with 17 additions and 5 deletions

View file

@ -12,13 +12,13 @@ from .base import Command
from .log import Log
from .index import Index
from .repo_bootstrap import RepoBootstrap
from .shutdown import Shutdown
"""New way to model pmbootstrap subcommands that can be invoked without PmbArgs."""
# Commands that are still invoked via pmb/helpers/frontend.py
unmigrated_commands = [
"init",
"shutdown",
"work_migrate",
"repo_missing",
"kconfig",
@ -66,6 +66,8 @@ def run_command(args: PmbArgs):
command = Index()
elif args.action == "repo_bootstrap":
command = RepoBootstrap(args.arch, args.repository)
elif args.action == "shutdown":
command = Shutdown()
else:
raise NotImplementedError(f"Command '{args.action}' is not implemented.")

14
pmb/commands/shutdown.py Normal file
View file

@ -0,0 +1,14 @@
# Copyright 2024 Caleb Connolly
# SPDX-License-Identifier: GPL-3.0-or-later
from __future__ import annotations
from pmb import commands
import pmb.chroot
class Shutdown(commands.Command):
def __init__(self):
pass
def run(self):
pmb.chroot.shutdown()

View file

@ -547,10 +547,6 @@ def qemu(args: PmbArgs):
pmb.qemu.run(args)
def shutdown(args: PmbArgs):
pmb.chroot.shutdown(args)
def stats(args: PmbArgs):
# Chroot suffix
chroot = Chroot.native()