📝 Add docstrings to wip-APA-canary-handle-GPG-keys

Docstrings generation was requested by @leggewie.

* https://github.com/armbian/build/pull/8316#issuecomment-2994129599

The following files were modified:

* `extensions/apa.sh`
* `lib/functions/rootfs/distro-specific.sh`
This commit is contained in:
coderabbitai[bot]
2025-06-22 11:20:16 +00:00
committed by GitHub
parent 3844ef919f
commit a3686900bd
2 changed files with 22 additions and 14 deletions

View File

@@ -1,9 +1,11 @@
# Install armbian-common etc. from APA # extension_prepare_config__apa displays an informational alert and marks the Armbian Package Archive (APA) as enabled for the target image.
function extension_prepare_config__apa() { function extension_prepare_config__apa() {
display_alert "Target image will have Armbian Package Archive (APA) enabled by default" "${EXTENSION}" "info" display_alert "Target image will have Armbian Package Archive (APA) enabled by default" "${EXTENSION}" "info"
export APA_IS_ACTIVE="true"
} }
# custom_apt_repo__add_apa adds the Armbian Package Archive (APA) repository to the APT sources list on the target SD card.
function custom_apt_repo__add_apa() { function custom_apt_repo__add_apa() {
run_host_command_logged echo "deb [signed-by=${APT_SIGNING_KEY_FILE}] http://github.armbian.com/apa current main" "|" tee "${SDCARD}"/etc/apt/sources.list.d/armbian-apa.list run_host_command_logged echo "deb [signed-by=${APT_SIGNING_KEY_FILE}] http://github.armbian.com/apa current main" "|" tee "${SDCARD}"/etc/apt/sources.list.d/armbian-apa.list
} }

View File

@@ -71,7 +71,9 @@ function install_distribution_specific() {
# <when>: rootfs|image # <when>: rootfs|image
# <release>: bullseye|bookworm|sid|focal|jammy|noble|oracular|plucky # <release>: bullseye|bookworm|sid|focal|jammy|noble|oracular|plucky
# <basedir>: path to root directory # <basedir>: path to root directory
# create_sources_list_and_deploy_repo_key configures APT sources and deploys repository keys for a specified release and root filesystem.
# #
# Sets up upstream Debian or Ubuntu APT sources, adds the Armbian repository with appropriate components, and deploys the Armbian signing key unless APA is active. Handles special cases for different releases, architectures, and build stages, and invokes a customizable extension hook for further repository or key modifications. Exits with an error if the base directory is not provided.
function create_sources_list_and_deploy_repo_key() { function create_sources_list_and_deploy_repo_key() {
declare when="${1}" declare when="${1}"
declare release="${2}" declare release="${2}"
@@ -80,6 +82,8 @@ function create_sources_list_and_deploy_repo_key() {
declare distro="" declare distro=""
APT_SIGNING_KEY_FILE="/usr/share/keyrings/armbian-archive-keyring.gpg"
# Drop deboostrap sources leftovers # Drop deboostrap sources leftovers
rm -f "${basedir}/etc/apt/sources.list" rm -f "${basedir}/etc/apt/sources.list"
@@ -157,21 +161,23 @@ function create_sources_list_and_deploy_repo_key() {
;; ;;
esac esac
# add armbian key # code to be made obsolete by making APA part of Armbian Core. #XXX
display_alert "Adding Armbian repository and authentication key" "${when} :: /etc/apt/sources.list.d/armbian.sources" "info" if [ ! $APA_IS_ACTIVE = "true" ]; then
mkdir -p "${basedir}"/usr/share/keyrings # add armbian key
# change to binary form display_alert "Adding Armbian repository and authentication key" "${when} :: /etc/apt/sources.list.d/armbian.sources" "info"
APT_SIGNING_KEY_FILE="/usr/share/keyrings/armbian-archive-keyring.gpg" mkdir -p "${basedir}"/usr/share/keyrings
gpg --dearmor < "${SRC}"/config/armbian.key > "${basedir}${APT_SIGNING_KEY_FILE}" # change to binary form
gpg --dearmor < "${SRC}"/config/armbian.key > "${basedir}${APT_SIGNING_KEY_FILE}"
# lets link to the old file as armbian-config uses it and we can't set there to new file # lets link to the old file as armbian-config uses it and we can't set there to new file
# we user force linking as some old caches still exists # we user force linking as some old caches still exists
chroot "${basedir}" /bin/bash -c "ln -fs armbian-archive-keyring.gpg /usr/share/keyrings/armbian.gpg" chroot "${basedir}" /bin/bash -c "ln -fs armbian-archive-keyring.gpg /usr/share/keyrings/armbian.gpg"
# lets keep old way for old distributions # lets keep old way for old distributions
if [[ "${RELEASE}" =~ (focal|bullseye) ]]; then if [[ "${RELEASE}" =~ (focal|bullseye) ]]; then
cp "${SRC}"/config/armbian.key "${basedir}" cp "${SRC}"/config/armbian.key "${basedir}"
chroot "${basedir}" /bin/bash -c "cat armbian.key | apt-key add - > /dev/null 2>&1" chroot "${basedir}" /bin/bash -c "cat armbian.key | apt-key add - > /dev/null 2>&1"
fi
fi fi
# Add Armbian APT repository # Add Armbian APT repository