config: add auto_zap_misconfigured_chroots (MR 2252)

This option will make pmbootstrap automatically zap chroots that are
initialized for the wrong channel, making it much faster to switch
between edge and systemd.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
Caleb Connolly 2024-06-13 22:48:43 +02:00 committed by Oliver Smith
parent af826c671d
commit c1aa5acdaa
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
4 changed files with 49 additions and 9 deletions

View file

@ -26,6 +26,18 @@ class SystemdConfig(enum.Enum):
return [e.value for e in SystemdConfig]
class AutoZapConfig(enum.StrEnum):
NO = "no"
YES = "yes"
SILENTLY = "silently"
def enabled(self) -> bool:
return self != AutoZapConfig.NO
def noisy(self) -> bool:
return self == AutoZapConfig.YES
class Config():
aports: List[Path] = [Path(os.path.expanduser("~") +
"/.local/var/pmbootstrap/cache_git/pmaports")]
@ -57,6 +69,8 @@ class Config():
ui_extras: bool = False
user: str = "user"
work: Path = Path(os.path.expanduser("~") + "/.local/var/pmbootstrap")
# automatically zap chroots that are for the wrong channel
auto_zap_misconfigured_chroots: AutoZapConfig = AutoZapConfig.NO
providers: Dict[str, str] = { }