forked from Mirror/pmbootstrap
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:
parent
a99ae02068
commit
656ff3f5bb
3 changed files with 17 additions and 5 deletions
|
@ -12,13 +12,13 @@ from .base import Command
|
||||||
from .log import Log
|
from .log import Log
|
||||||
from .index import Index
|
from .index import Index
|
||||||
from .repo_bootstrap import RepoBootstrap
|
from .repo_bootstrap import RepoBootstrap
|
||||||
|
from .shutdown import Shutdown
|
||||||
|
|
||||||
"""New way to model pmbootstrap subcommands that can be invoked without PmbArgs."""
|
"""New way to model pmbootstrap subcommands that can be invoked without PmbArgs."""
|
||||||
|
|
||||||
# Commands that are still invoked via pmb/helpers/frontend.py
|
# Commands that are still invoked via pmb/helpers/frontend.py
|
||||||
unmigrated_commands = [
|
unmigrated_commands = [
|
||||||
"init",
|
"init",
|
||||||
"shutdown",
|
|
||||||
"work_migrate",
|
"work_migrate",
|
||||||
"repo_missing",
|
"repo_missing",
|
||||||
"kconfig",
|
"kconfig",
|
||||||
|
@ -66,6 +66,8 @@ def run_command(args: PmbArgs):
|
||||||
command = Index()
|
command = Index()
|
||||||
elif args.action == "repo_bootstrap":
|
elif args.action == "repo_bootstrap":
|
||||||
command = RepoBootstrap(args.arch, args.repository)
|
command = RepoBootstrap(args.arch, args.repository)
|
||||||
|
elif args.action == "shutdown":
|
||||||
|
command = Shutdown()
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError(f"Command '{args.action}' is not implemented.")
|
raise NotImplementedError(f"Command '{args.action}' is not implemented.")
|
||||||
|
|
||||||
|
|
14
pmb/commands/shutdown.py
Normal file
14
pmb/commands/shutdown.py
Normal 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()
|
||||||
|
|
|
@ -547,10 +547,6 @@ def qemu(args: PmbArgs):
|
||||||
pmb.qemu.run(args)
|
pmb.qemu.run(args)
|
||||||
|
|
||||||
|
|
||||||
def shutdown(args: PmbArgs):
|
|
||||||
pmb.chroot.shutdown(args)
|
|
||||||
|
|
||||||
|
|
||||||
def stats(args: PmbArgs):
|
def stats(args: PmbArgs):
|
||||||
# Chroot suffix
|
# Chroot suffix
|
||||||
chroot = Chroot.native()
|
chroot = Chroot.native()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue