mirror of
https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git
synced 2025-07-13 11:29:46 +03:00
Add the following question to "pmbootstrap init": [22:12:57] Based on your UI selection, 'default' will result in installing systemd. [22:12:57] Install systemd? (default/always/never) [default]: Determine whether the UI prefers to have systemd or not, based on "pmb:systemd" in the UI package's APKBUILD. Determine whether the currently selected branch supports systemd, by checking for a "[repo:systemd]" section in pmaports.cfg. This section will also contain bootstrap information, to be used in future patches.
33 lines
1.2 KiB
Python
33 lines
1.2 KiB
Python
# Copyright 2023 Clayton Craft
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
import os
|
|
import glob
|
|
import pmb.helpers.pmaports
|
|
import pmb.parse
|
|
|
|
|
|
def list(args, arch):
|
|
"""
|
|
Get all UIs, for which aports are available with their description.
|
|
|
|
:param arch: device architecture, for which the UIs must be available
|
|
:returns: [("none", "No graphical..."), ("weston", "Wayland reference...")]
|
|
"""
|
|
ret = [("none", "Bare minimum OS image for testing and manual"
|
|
" customization. The \"console\" UI should be selected if"
|
|
" a graphical UI is not desired.")]
|
|
for path in sorted(glob.glob(args.aports + "/main/postmarketos-ui-*")):
|
|
apkbuild = pmb.parse.apkbuild(f"{path}/APKBUILD")
|
|
ui = os.path.basename(path).split("-", 2)[2]
|
|
if pmb.helpers.package.check_arch(args, apkbuild["pkgname"], arch):
|
|
ret.append((ui, apkbuild["pkgdesc"]))
|
|
return ret
|
|
|
|
|
|
def check_option(args, ui, option):
|
|
"""
|
|
Check if an option, such as pmb:systemd, is inside an UI's APKBUILD.
|
|
"""
|
|
pkgname = f"postmarketos-ui-{ui}"
|
|
apkbuild = pmb.helpers.pmaports.get(args, pkgname, subpackages=False)
|
|
return option in apkbuild["options"]
|