Skip to content

Commit dd90a1a

Browse files
bjordiscollakusimonbeaudoin0935
authored andcommitted
build-ubuntu-rootfs.sh: Add support for injecting custom apt sources from package manifest
- Extended script functionality to parse and add custom apt sources from the JSON package manifest, enabling installation from additional repositories during rootfs build. - Ensures each custom source line is written to a dedicated sources.list.d entry, preserving compatibility and flexibility for multi-repo configurations. - This enhancement improves package installation workflows, supports upstream and third-party repositories, and maintains backward compatibility with legacy and config-driven builds. Signed-off-by: Bjordis Collaku <[email protected]>
1 parent 705c2aa commit dd90a1a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

rootfs/scripts/build-ubuntu-rootfs.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# - Supports Qualcomm product configuration file (.conf) for build parameters.
1414
# - Supports JSON package manifest for additional package installation
1515
# (via apt or local .deb) inside the rootfs.
16+
# - Supports injecting custom apt sources from the package manifest.
1617
# - Backward compatible with legacy 2-argument mode (kernel.deb, firmware.deb).
1718
# - Parses qcom-product.conf (if provided) or uses defaults to determine the base image.
1819
# - Runs target platform-specific image preprocessing to populate rootfs/.
@@ -265,6 +266,18 @@ case "$(echo "$TARGET_PLATFORM" | tr '[:upper:]' '[:lower:]')" in
265266
;;
266267
esac
267268

269+
# ==============================================================================
270+
# Step 3.5: Add custom apt sources from manifest (if provided)
271+
# ==============================================================================
272+
if [[ "$USE_MANIFEST" -eq 1 && -n "$MANIFEST" ]]; then
273+
echo "[INFO] Adding custom apt sources from manifest..."
274+
jq -c '.apt_sources[]?' "$MANIFEST" | while read -r row; do
275+
NAME=$(echo "$row" | jq -r '.name // "customrepo"')
276+
SRC_LINE=$(echo "$row" | jq -r '.source_line')
277+
echo "$SRC_LINE" >> "$ROOTFS_DIR/etc/apt/sources.list.d/${NAME}.list"
278+
done
279+
fi
280+
268281
# ==============================================================================
269282
# Step 4: Inject Kernel, Firmware, and Working resolv.conf
270283
# ==============================================================================

0 commit comments

Comments
 (0)