From dd4a4212a3754fd008983bdaf25309a22f5ea34d Mon Sep 17 00:00:00 2001 From: InsanePrawn Date: Sun, 9 Jul 2023 07:16:06 +0200 Subject: [PATCH] config/cli: init PKGBUILDs after main config is complete --- config/cli.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/config/cli.py b/config/cli.py index 740ab17..4b84830 100644 --- a/config/cli.py +++ b/config/cli.py @@ -1,5 +1,6 @@ import click import logging +import os from copy import deepcopy from typing import Any, Callable, Iterable, Mapping, Optional, Union @@ -260,6 +261,7 @@ def cmd_config_init( ): """Initialize the config file""" if not non_interactive: + from packages.cli import cmd_init as cmd_init_pkgbuilds logging.info(CONFIG_MSG) results: dict[str, dict] = {} for section in sections: @@ -282,6 +284,13 @@ def cmd_config_init( config.write() else: return + if not non_interactive and not os.path.exists(os.path.join(config.get_path('pkgbuilds'), '.git')): + extra_msg = " This way, we can give you a list of devices and flavours later" if 'profiles' in sections else '' + if click.confirm( + f"It seems you don't have our PKGBUILDs checked out yet.\nWould you like KBS to fetch them?{extra_msg}", + default=True, + ): + execute_without_exit(click.Context(cmd_config).invoke, ['packages', 'init'], cmd_init_pkgbuilds) if 'profiles' in sections: print("Configuring profiles") current_profile = 'default' if 'current' not in config.file.profiles else config.file.profiles.current