imagebuilder: add function to show manifest
[openwrt/openwrt.git] / target / imagebuilder / files / Makefile
index 95df8bf1133c0a3565f7dc0b9f7169fd18a175a4..e0c0132b853c5189fc5bf509123be788e89ef179 100644 (file)
@@ -45,6 +45,14 @@ Building images:
        make image FILES="<path>" # include extra files from <path>
        make image BIN_DIR="<path>" # alternative output directory for the images
        make image EXTRA_IMAGE_NAME="<string>" # Add this to the output image filename (sanitized)
+
+Print manifest:
+       List "all" packages which get installed into the image.
+       You can use the following parameters:
+
+       make manifest PROFILE="<profilename>" # override the default target profile
+       make manifest PACKAGES="<pkg1> [<pkg2> [<pkg3> ...]]" # include extra packages
+
 endef
 $(eval $(call shexport,Helptext))
 
@@ -108,6 +116,13 @@ _call_image: staging_dir/host/.prereq-build
        $(MAKE) -s build_image
        $(MAKE) -s checksum
 
+_call_manifest: FORCE
+       rm -rf $(TARGET_DIR)
+       mkdir -p $(TARGET_DIR) $(BIN_DIR) $(TMP_DIR) $(DL_DIR)
+       $(MAKE) package_reload >/dev/null 2>/dev/null
+       $(MAKE) package_install >/dev/null 2>/dev/null
+       $(OPKG) list-installed
+
 package_index: FORCE
        @echo >&2
        @echo Building package index... >&2
@@ -164,7 +179,7 @@ info:
 
 PROFILE_FILTER = $(filter DEVICE_$(PROFILE) $(PROFILE),$(PROFILE_NAMES))
 
-image:
+_check_profile: FORCE
 ifneq ($(PROFILE),)
   ifeq ($(PROFILE_FILTER),)
        @echo 'Profile "$(PROFILE)" does not exist!'
@@ -172,6 +187,9 @@ ifneq ($(PROFILE),)
        @exit 1
   endif
 endif
+
+image:
+       $(MAKE) -s _check_profile
        (unset PROFILE FILES PACKAGES MAKEFLAGS; \
        $(MAKE) -s _call_image \
                $(if $(PROFILE),USER_PROFILE="$(PROFILE_FILTER)") \
@@ -179,4 +197,11 @@ endif
                $(if $(PACKAGES),USER_PACKAGES="$(PACKAGES)") \
                $(if $(BIN_DIR),BIN_DIR="$(BIN_DIR)"))
 
-.SILENT: help info image
+manifest: FORCE
+       $(MAKE) -s _check_profile
+       (unset PROFILE FILES PACKAGES MAKEFLAGS; \
+       $(MAKE) -s _call_manifest \
+               $(if $(PROFILE),USER_PROFILE="$(PROFILE_FILTER)") \
+               $(if $(PACKAGES),USER_PACKAGES="$(PACKAGES)"))
+
+.SILENT: help info image manifest