Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions extensions/apa.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Install armbian-common etc. from APA

function extension_prepare_config__apa() {
display_alert "Target image will have Armbian Package Archive (APA) enabled by default" "${EXTENSION}" "info"
}

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
}
Comment on lines +7 to +9
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

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.

Suggested change
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'"
}


function post_armbian_repo_customize_image__install_from_apa() {
# do not install armbian recommends for minimal images
[[ "${BUILD_MINIMAL,,}" =~ ^(true|yes)$ ]] && INSTALL_RECOMMENDS="no" || INSTALL_RECOMMENDS="yes"
chroot_sdcard_apt_get --install-recommends=$INSTALL_RECOMMENDS install "armbian-common armbian-bsp"
Comment on lines +13 to +14
Copy link
Contributor

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.

Suggested change
[[ "${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"


Comment on lines +14 to +15
Copy link
Contributor

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.

# install desktop environmnent if requested
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,,}"
;;
Comment on lines +17 to +21
Copy link
Contributor

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.

Suggested change
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

esac
}