Files
armbian-build/extensions/brostrend-aic8800-dkms.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

49 lines
2.4 KiB
Bash

# @description Installs the AIC8800 WiFi/BT DKMS driver for BroStrend USB adapters. Fetches the latest `aic8800-dkms` release from `Shadowrom2020/aic8800-dkms` GitHub and builds the kernel module in the chroot. Forces `INSTALL_HEADERS=yes` — requires a kernel with working headers package.
function extension_finish_config__install_kernel_headers_for_aic8800_dkms() {
if [[ "${KERNEL_HAS_WORKING_HEADERS}" != "yes" ]]; then
display_alert "Kernel version has no working headers package" "skipping aic8800 dkms for kernel v${KERNEL_MAJOR_MINOR}" "warn"
return 0
fi
declare -g INSTALL_HEADERS="yes"
display_alert "Forcing INSTALL_HEADERS=yes; for use with aic8800 dkms" "${EXTENSION}" "debug"
}
function post_install_kernel_debs__install_aic8800_dkms_package() {
if [[ "${INSTALL_HEADERS}" != "yes" || "${KERNEL_HAS_WORKING_HEADERS}" != "yes" ]]; then
return 0
fi
local api_url="https://api.github.com/repos/Shadowrom2020/aic8800-dkms/releases/latest"
local latest_version
local aic8800_dkms_url
local api_output
if ! api_output=$(curl -f --silent --show-error --location "${api_url}" 2>&1); then
display_alert "Failed to fetch latest aic8800-dkms release from GitHub: ${api_output}" "${EXTENSION}" "error"
return 1
fi
latest_version=$(printf '%s' "${api_output}" | jq -r '.tag_name' 2> /dev/null || true)
if [[ -z "${latest_version}" || "${latest_version}" == "null" ]]; then
display_alert "Invalid latest_version from GitHub API: '${latest_version}'" "${EXTENSION}" "error"
return 1
fi
aic8800_dkms_url="https://github.com/Shadowrom2020/aic8800-dkms/releases/download/${latest_version}/aic8800-dkms.deb"
if [[ "${GITHUB_MIRROR}" == "ghproxy" ]]; then
local ghproxy_header="https://ghfast.top/"
aic8800_dkms_url="${aic8800_dkms_url/https:\/\/github.com\//${ghproxy_header}github.com/}"
fi
use_clean_environment="yes" chroot_sdcard "wget \"${aic8800_dkms_url}\" -P /tmp"
display_alert "Installing aic8800 package, will build kernel module in chroot" "${EXTENSION}" "info"
declare -ag if_error_find_files_sdcard=("/var/lib/dkms/aic8800*/*/build/*.log")
# eject is needed by the aic8800-dkms package/DKMS workflow to safely unmount
# or eject media devices when building/installing kernel modules inside chroot.
use_clean_environment="yes" chroot_sdcard_apt_get_install "eject"
use_clean_environment="yes" chroot_sdcard_apt_get_install "/tmp/aic8800-dkms.deb"
use_clean_environment="yes" chroot_sdcard "rm -f /tmp/aic8800-dkms.deb"
}