-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
extensions: add APA extension #8133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
extensions: add APA extension #8133
Conversation
WalkthroughA new script extension named Suggested labels
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code Graph Analysis (1)extensions/apa.sh (2)
🪛 Shellcheck (0.10.0)extensions/apa.sh[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive. (SC2148) 🔇 Additional comments (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
extensions/apa.sh
(1 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
extensions/apa.sh
[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.
(SC2148)
🔇 Additional comments (1)
extensions/apa.sh (1)
3-5
: Looks good: user notification is clear.The
extension_prepare_config__apa
function cleanly informs the user that APA will be enabled by default, aligning with the extension’s purpose.
[[ "${BUILD_MINIMAL,,}" =~ ^(true|yes)$ ]] && INSTALL_RECOMMENDS="no" || INSTALL_RECOMMENDS="yes" | ||
chroot_sdcard_apt_get --install-recommends=$INSTALL_RECOMMENDS install "armbian-common armbian-bsp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Replace Bash-specific ${VAR,,}
with a POSIX-compatible check.
If this script is ever run under /bin/sh
, ${BUILD_MINIMAL,,}
and regex matching may fail. Use a case
statement for a portable, case-insensitive check:
-[[ "${BUILD_MINIMAL,,}" =~ ^(true|yes)$ ]] && INSTALL_RECOMMENDS="no" || INSTALL_RECOMMENDS="yes"
+case "${BUILD_MINIMAL}" in
+ [Tt][Rr][Uu][Ee]|[Yy][Ee][Ss]) INSTALL_RECOMMENDS="no" ;;
+ *) INSTALL_RECOMMENDS="yes" ;;
+esac
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
[[ "${BUILD_MINIMAL,,}" =~ ^(true|yes)$ ]] && INSTALL_RECOMMENDS="no" || INSTALL_RECOMMENDS="yes" | |
chroot_sdcard_apt_get --install-recommends=$INSTALL_RECOMMENDS install "armbian-common armbian-bsp" | |
case "${BUILD_MINIMAL}" in | |
[Tt][Rr][Uu][Ee]|[Yy][Ee][Ss]) INSTALL_RECOMMENDS="no" ;; | |
*) INSTALL_RECOMMENDS="yes" ;; | |
esac | |
chroot_sdcard_apt_get --install-recommends=$INSTALL_RECOMMENDS install "armbian-common armbian-bsp" |
chroot_sdcard_apt_get --install-recommends=$INSTALL_RECOMMENDS install "armbian-common armbian-bsp" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Refresh APT cache and fix package arguments.
Before installing from APA, run apt-get update
in the chroot. Also, supply package names as separate arguments instead of a single quoted string:
-function post_armbian_repo_customize_image__install_from_apa() {
- # do not install armbian recommends for minimal images
- [[ ... ]]
- chroot_sdcard_apt_get --install-recommends=$INSTALL_RECOMMENDS install "armbian-common armbian-bsp"
+function post_armbian_repo_customize_image__install_from_apa() {
+ # do not install armbian recommends for minimal images
+ case "${BUILD_MINIMAL}" in ... esac
+
+ # Refresh repository index
+ chroot_sdcard_apt_get update
+
+ # Install core APA packages
+ chroot_sdcard_apt_get --install-recommends="$INSTALL_RECOMMENDS" install armbian-common armbian-bsp
Committable suggestion skipped: line range outside the PR's diff.
function custom_apt_repo__add_apa() { | ||
run_host_command_logged echo "deb [signed-by=${APT_SIGNING_KEY_FILE}] https://github.armbian.com/apa current main" "|" tee "${SDCARD}"/etc/apt/sources.list.d/armbian-apa.list | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix incorrect piping in custom_apt_repo__add_apa
.
The literal "|"
argument to echo
won’t create a pipe. Wrap the entire command in Bash so it executes the pipe properly:
-function custom_apt_repo__add_apa() {
- run_host_command_logged echo "deb [signed-by=${APT_SIGNING_KEY_FILE}] https://github.armbian.com/apa current main" "|" tee "${SDCARD}"/etc/apt/sources.list.d/armbian-apa.list
-}
+function custom_apt_repo__add_apa() {
+ run_host_command_logged bash -c \
+ "echo 'deb [signed-by=${APT_SIGNING_KEY_FILE}] https://github.armbian.com/apa current main' | \
+ tee '${SDCARD}/etc/apt/sources.list.d/armbian-apa.list'"
+}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
function custom_apt_repo__add_apa() { | |
run_host_command_logged echo "deb [signed-by=${APT_SIGNING_KEY_FILE}] https://github.armbian.com/apa current main" "|" tee "${SDCARD}"/etc/apt/sources.list.d/armbian-apa.list | |
} | |
function custom_apt_repo__add_apa() { | |
run_host_command_logged bash -c \ | |
"echo 'deb [signed-by=${APT_SIGNING_KEY_FILE}] https://github.armbian.com/apa current main' | \ | |
tee '${SDCARD}/etc/apt/sources.list.d/armbian-apa.list'" | |
} |
case ${DESKTOP_ENVIRONMENT^^} in | ||
XFCE|KDE|GNOME) | ||
display_alert "installing ${DESKTOP_ENVIRONMENT^^} desktop environment" "${EXTENSION}: ${DESKTOP_ENVIRONMENT^^}" "info" | ||
chroot_sdcard_apt_get --install-recommends=yes "armbian-desktop-${DESKTOP_ENVIRONMENT,,}" | ||
;; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Correct desktop environment installation command.
Similarly, include the install
subcommand and avoid quoting multiple packages as one string. Also make the case‐insensitive match POSIX‐compliant:
-case ${DESKTOP_ENVIRONMENT^^} in
- XFCE|KDE|GNOME)
- display_alert "installing ${DESKTOP_ENVIRONMENT^^} desktop environment" "${EXTENSION}: ${DESKTOP_ENVIRONMENT^^}" "info"
- chroot_sdcard_apt_get --install-recommends=yes "armbian-desktop-${DESKTOP_ENVIRONMENT,,}"
- ;;
-esac
+case "${DESKTOP_ENVIRONMENT}" in
+ [Xx][Ff][Cc][Ee]|[Kk][Dd][Ee]|[Gg][Nn][Oo][Mm][Ee])
+ display_alert "Installing ${DESKTOP_ENVIRONMENT} desktop environment" \
+ "${EXTENSION}: ${DESKTOP_ENVIRONMENT}" "info"
+ chroot_sdcard_apt_get --install-recommends=yes install armbian-desktop-"${DESKTOP_ENVIRONMENT}"
+ ;;
+esac
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
case ${DESKTOP_ENVIRONMENT^^} in | |
XFCE|KDE|GNOME) | |
display_alert "installing ${DESKTOP_ENVIRONMENT^^} desktop environment" "${EXTENSION}: ${DESKTOP_ENVIRONMENT^^}" "info" | |
chroot_sdcard_apt_get --install-recommends=yes "armbian-desktop-${DESKTOP_ENVIRONMENT,,}" | |
;; | |
case "${DESKTOP_ENVIRONMENT}" in | |
[Xx][Ff][Cc][Ee]|[Kk][Dd][Ee]|[Gg][Nn][Oo][Mm][Ee]) | |
display_alert "Installing ${DESKTOP_ENVIRONMENT} desktop environment" \ | |
"${EXTENSION}: ${DESKTOP_ENVIRONMENT}" "info" | |
chroot_sdcard_apt_get --install-recommends=yes install armbian-desktop-"${DESKTOP_ENVIRONMENT}" | |
;; | |
esac |
using this extension allows for activation of the APA armbian package archive and installation of the provided binary packages at image creation time from within the Armbian Build Framework. The goal of APA is to simplify maintenance of Armbian Core by moving dependency logic and other packaging information into a separate space and handle that meta-data with the proper distribution-creation and -publication tools. Currently, much of this is done with fragile bash scripting in Armbian Core instead. https://github.com/armbian/apa
445ebad
to
ceb1b55
Compare
using this extension allows for activation of the APA armbian package archive and installation of the provided binary packages at image creation time from within the Armbian Build Framework.
The goal of APA is to simplify maintenance of Armbian Core by moving dependency logic and other packaging information into a separate space and handle that meta-data with the proper distribution-creation and -publication tools. Currently, much of this is done with fragile bash scripting in Armbian Core instead.