Fix 1747 | Additional post-installation menu options (#3393)
* Provide more post installation options * Update
This commit is contained in:
parent
130d1a6ff8
commit
2f18b8d2fe
|
|
@ -1,5 +1,6 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from enum import Enum
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING, assert_never
|
||||
|
||||
|
|
@ -24,6 +25,12 @@ if TYPE_CHECKING:
|
|||
_: Callable[[str], DeferredTranslation]
|
||||
|
||||
|
||||
class PostInstallationAction(Enum):
|
||||
EXIT = str(_('Exit archinstall'))
|
||||
REBOOT = str(_('Reboot system'))
|
||||
CHROOT = str(_('chroot into installation for post-installation configurations'))
|
||||
|
||||
|
||||
def ask_ntp(preset: bool = True) -> bool:
|
||||
header = str(_('Would you like to use automatic time synchronization (NTP) with the default time servers?\n')) + '\n'
|
||||
header += str(_(
|
||||
|
|
@ -281,19 +288,25 @@ def add_number_of_parallel_downloads(preset: int | None = None) -> int | None:
|
|||
return downloads
|
||||
|
||||
|
||||
def ask_chroot() -> bool:
|
||||
prompt = str(_('Would you like to chroot into the newly created installation and perform post-installation configuration?')) + '\n'
|
||||
group = MenuItemGroup.yes_no()
|
||||
def ask_post_installation() -> PostInstallationAction:
|
||||
header = str(_('Installation completed')) + '\n\n'
|
||||
header += str(_('What would you like to do next?')) + '\n'
|
||||
|
||||
items = [MenuItem(action.value, value=action) for action in PostInstallationAction]
|
||||
group = MenuItemGroup(items)
|
||||
|
||||
result = SelectMenu(
|
||||
group,
|
||||
header=prompt,
|
||||
header=header,
|
||||
allow_skip=False,
|
||||
alignment=Alignment.CENTER,
|
||||
columns=2,
|
||||
orientation=Orientation.HORIZONTAL,
|
||||
).run()
|
||||
|
||||
return result.item() == MenuItem.yes()
|
||||
match result.type_:
|
||||
case ResultType.Selection:
|
||||
return result.get_value()
|
||||
case _:
|
||||
raise ValueError('Post installation action not handled')
|
||||
|
||||
|
||||
def ask_abort() -> None:
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from archinstall import SysInfo
|
||||
|
|
@ -7,7 +8,7 @@ from archinstall.lib.disk.filesystem import FilesystemHandler
|
|||
from archinstall.lib.disk.utils import disk_layouts
|
||||
from archinstall.lib.global_menu import GlobalMenu
|
||||
from archinstall.lib.installer import Installer, accessibility_tools_in_use, run_custom_user_commands
|
||||
from archinstall.lib.interactions.general_conf import ask_chroot
|
||||
from archinstall.lib.interactions.general_conf import PostInstallationAction, ask_post_installation
|
||||
from archinstall.lib.models import AudioConfiguration, Bootloader
|
||||
from archinstall.lib.models.device_model import (
|
||||
DiskLayoutConfiguration,
|
||||
|
|
@ -147,19 +148,22 @@ def perform_installation(mountpoint: Path) -> None:
|
|||
|
||||
installation.genfstab()
|
||||
|
||||
info("For post-installation tips, see https://wiki.archlinux.org/index.php/Installation_guide#Post-installation")
|
||||
debug(f"Disk states after installing:\n{disk_layouts()}")
|
||||
|
||||
if not arch_config_handler.args.silent:
|
||||
with Tui():
|
||||
chroot = ask_chroot()
|
||||
action = ask_post_installation()
|
||||
|
||||
if chroot:
|
||||
try:
|
||||
installation.drop_to_shell()
|
||||
except Exception:
|
||||
match action:
|
||||
case PostInstallationAction.EXIT:
|
||||
pass
|
||||
|
||||
debug(f"Disk states after installing:\n{disk_layouts()}")
|
||||
case PostInstallationAction.REBOOT:
|
||||
os.system('reboot')
|
||||
case PostInstallationAction.CHROOT:
|
||||
try:
|
||||
installation.drop_to_shell()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
def guided() -> None:
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import os
|
||||
from pathlib import Path
|
||||
|
||||
from archinstall import SysInfo, debug, error, info
|
||||
|
|
@ -7,7 +8,7 @@ from archinstall.lib.disk.filesystem import FilesystemHandler
|
|||
from archinstall.lib.disk.utils import disk_layouts
|
||||
from archinstall.lib.global_menu import GlobalMenu
|
||||
from archinstall.lib.installer import Installer, accessibility_tools_in_use, run_custom_user_commands
|
||||
from archinstall.lib.interactions.general_conf import ask_chroot
|
||||
from archinstall.lib.interactions.general_conf import PostInstallationAction, ask_post_installation
|
||||
from archinstall.lib.models import AudioConfiguration, Bootloader
|
||||
from archinstall.lib.models.device_model import (
|
||||
DiskLayoutConfiguration,
|
||||
|
|
@ -146,19 +147,22 @@ def perform_installation(mountpoint: Path) -> None:
|
|||
|
||||
installation.genfstab()
|
||||
|
||||
info("For post-installation tips, see https://wiki.archlinux.org/index.php/Installation_guide#Post-installation")
|
||||
debug(f"Disk states after installing:\n{disk_layouts()}")
|
||||
|
||||
if not arch_config_handler.args.silent:
|
||||
with Tui():
|
||||
chroot = ask_chroot()
|
||||
action = ask_post_installation()
|
||||
|
||||
if chroot:
|
||||
try:
|
||||
installation.drop_to_shell()
|
||||
except Exception:
|
||||
match action:
|
||||
case PostInstallationAction.EXIT:
|
||||
pass
|
||||
|
||||
debug(f"Disk states after installing:\n{disk_layouts()}")
|
||||
case PostInstallationAction.REBOOT:
|
||||
os.system('reboot')
|
||||
case PostInstallationAction.CHROOT:
|
||||
try:
|
||||
installation.drop_to_shell()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
def guided() -> None:
|
||||
|
|
|
|||
Loading…
Reference in New Issue