Files
armbian-build/extensions/wayland-sessions-mask.sh
Igor 2046a78660 extensions: add @description headers and a list generator (#10534)
* extensions: add @description headers and a list generator

Add a one-line `# @description` header near the top of every extension in
extensions/ (85 files), each ~35-45 words / 3 sentences, source-verified
against the extension's actual behaviour. Two extensions with a dedicated
docs page also carry a `# @doc-page` link.

Add lib/tools/gen-extensions-list.py, which scans extensions/**/*.sh for
these headers and prints the Markdown extensions reference consumed by the
documentation repo. The list is no longer hand-maintained: edit an
extension's `# @description` and the generator brings the change over.

Signed-off-by: Igor Pecovnik <igor@armbian.com>

* extensions: correct descriptions flagged in review, validate @doc-page

Seven @description headers claimed more than the code does:

  cleanup-space-final-image  zerofree globs ${LOOP}p?, so p10+ is not covered
  image-output-abl           one recovery image from ABL_DTB_LIST[0], not per-DTB
  marvell-tools              binaries-marvell and cryptopp track branches, not pins
  nvidia                     also skipped without a working headers package
  odin2-preset-firstrun      ships hardcoded 1234 root/user passwords
  preset-firstrun            static networking is on by default, not optional
  uefi-edk2-rk3588           acpi=off is a default, not forced

Reword each to match, and call out the two credential hazards explicitly
rather than leaving them implied.

In the generator, restrict @doc-page to site-relative paths. The value goes
into a Markdown link target on the published docs site and Python-Markdown
does not sanitize URL schemes, so a "javascript:" target would survive into
the page; unusable values are now dropped with a warning on stderr.

Signed-off-by: Igor Pecovnik <igor@armbian.com>

* gen-extensions-list: close two holes in @doc-page validation

DOC_PAGE_RE accepted "//external.example/x". "/" is in the character class, so
after the required leading slash a second one matched happily -- the protocol-
relative case the comment claimed to reject sailed straight through. Add a
negative lookahead.

The annotation parser also matched a single \S+ token, so "@doc-page /guide
extra" and a bare "@doc-page" failed to match at all and were dropped in
silence, with no warning. Capture the whole value instead and let validation
reject it, so malformed annotations are reported rather than ignored.

Output over the current extensions/ tree is byte-identical.

Signed-off-by: Igor Pecovnik <igor@armbian.com>

---------

Signed-off-by: Igor Pecovnik <igor@armbian.com>
2026-08-26 19:14:35 +02:00

44 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bash
# @description Masks Wayland desktop session entries on boards with limited or unstable Wayland support due to GPU or driver constraints. Places empty marker files in `/usr/local/share/wayland-sessions/`, which overrides `/usr/share/wayland-sessions/`, in a desktop-agnostic, upgrade-safe way. Enable it via `enable_extension` in a board config; sessions stay enabled otherwise.
# ------------------------------------------------------------------------------
# Mask Wayland desktop sessions
#
# Some boards have limited or unstable Wayland support due to GPU or driver
# constraints. This extension allows board maintainers to disable Wayland
# sessions in a desktop-agnostic and upgrade-safe manner by masking session
# definitions.
#
# Wayland sessions are masked by placing empty marker files with matching names
# in /usr/local/share/wayland-sessions/, which takes precedence over
# /usr/share/wayland-sessions/.
#
# Usage (board config):
# enable_extension "wayland-sessions-mask"
#
# Default behavior when unset: Wayland sessions remain enabled.
# ------------------------------------------------------------------------------
post_post_debootstrap_tweaks__wayland_sessions_mask() {
# Only apply to desktop images with Wayland sessions present
[[ -d "${SDCARD}/usr/share/wayland-sessions" ]] || return 0
local src_dir dst_dir sess_file
src_dir="${SDCARD}/usr/share/wayland-sessions"
dst_dir="${SDCARD}/usr/local/share/wayland-sessions"
display_alert \
"Masking Wayland desktop sessions" \
"Board policy: wayland-sessions-mask" \
"info"
mkdir -p "${dst_dir}"
# Mask all existing Wayland session definitions
for sess_file in "${src_dir}"/*.desktop; do
[[ -f "${sess_file}" ]] || continue
: > "${dst_dir}/$(basename "${sess_file}")"
done
}