From 5b51ba8ab59b892b51da74fdec67f50314f0d7f5 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 11 Feb 2014 01:25:10 +0100 Subject: [PATCH] Shorter image names, make manifest generator more robust --- Makefile | 21 ++++++++++---------- include/gluon.mk | 2 ++ include/profiles.mk | 48 ++++++++++++++++++++++----------------------- 3 files changed, 36 insertions(+), 35 deletions(-) diff --git a/Makefile b/Makefile index 31d2c739..e5776d9b 100644 --- a/Makefile +++ b/Makefile @@ -230,7 +230,7 @@ BIN_DIR = $(PROFILE_BUILDDIR)/images TMP_DIR = $(PROFILE_BUILDDIR)/tmp TARGET_DIR = $(PROFILE_BUILDDIR)/root -IMAGE_PREFIX = gluon-$(GLUON_SITE_CODE)-$$(cat $(gluon_prepared_stamp))-$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET)) +IMAGE_PREFIX = gluon-$(GLUON_SITE_CODE)-$$(cat $(gluon_prepared_stamp)) OPKG:= \ IPKG_TMP="$(TMP_DIR)/ipkgtmp" \ @@ -280,15 +280,15 @@ image: FORCE +$(GLUONMAKE) package_install $(call Image/mkfs/prepare) - $(_SINGLE)$(NO_TRACE_MAKE) -C $(TOPDIR)/target/linux/$(BOARD)/image install TARGET_BUILD=1 IB=1 IMG_PREFIX="$(IMAGE_PREFIX)" \ + $(_SINGLE)$(NO_TRACE_MAKE) -C $(TOPDIR)/target/linux/$(BOARD)/image install TARGET_BUILD=1 IB=1 IMG_PREFIX="$(IMAGE_PREFIX)-$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))" \ PROFILE="$(PROFILE)" KDIR="$(PROFILE_KDIR)" TARGET_DIR="$(TARGET_DIR)" BIN_DIR="$(BIN_DIR)" TMP_DIR="$(TMP_DIR)" $(foreach model,$(GLUON_$(PROFILE)_MODELS), \ - rm -f $(GLUON_IMAGEDIR)/factory/gluon-*-$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))-$(model)-*.bin && \ - rm -f $(GLUON_IMAGEDIR)/sysupgrade/gluon-*-$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))-$(model)-*.bin && \ + rm -f $(GLUON_IMAGEDIR)/factory/gluon-*-$(GLUON_$(profile)_MODEL_$(model)).bin && \ + rm -f $(GLUON_IMAGEDIR)/sysupgrade/gluon-*-$(GLUON_$(profile)_MODEL_$(model))-sysupgrade.bin && \ \ - cp $(BIN_DIR)/$(IMAGE_PREFIX)-$(model)-*-factory.bin $(GLUON_IMAGEDIR)/factory/ && \ - cp $(BIN_DIR)/$(IMAGE_PREFIX)-$(model)-*-sysupgrade.bin $(GLUON_IMAGEDIR)/sysupgrade/ && \ + cp $(BIN_DIR)/$(IMAGE_PREFIX)-$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))-$(model)-factory.bin $(GLUON_IMAGEDIR)/factory/$(IMAGE_PREFIX)-$(GLUON_$(PROFILE)_MODEL_$(model)).bin && \ + cp $(BIN_DIR)/$(IMAGE_PREFIX)-$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))-$(model)-sysupgrade.bin $(GLUON_IMAGEDIR)/sysupgrade/$(IMAGE_PREFIX)-$(GLUON_$(PROFILE)_MODEL_$(model))-sysupgrade.bin && \ ) : call_image/%: FORCE @@ -296,16 +296,15 @@ call_image/%: FORCE images: $(patsubst %,call_image/%,$(PROFILES)) ; - manifest: FORCE mkdir -p $(GLUON_IMAGEDIR)/sysupgrade (cd $(GLUON_IMAGEDIR)/sysupgrade && echo "BRANCH=$(BRANCH)" && echo && ($(foreach profile,$(PROFILES), \ $(foreach model,$(GLUON_$(profile)_MODELS), \ - for file in gluon-*-$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))-$(model)-*-sysupgrade.bin; do \ + for file in gluon-*-'$(GLUON_$(profile)_MODEL_$(model))-sysupgrade.bin'; do \ [ -e "$$file" ] && echo \ - $(GLUON_$(profile)_MODEL_$(model)) \ - $$(echo "$$file" | sed -n -r 's/^gluon-$(GLUON_SITE_CODE)-(.*)-$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))-$(model)-[^-]*-sysupgrade\.bin$$/\1/p') \ - $$(sha512sum "$$file" | awk '{print $$1}') \ + '$(GLUON_$(profile)_MODEL_$(model))' \ + "$$(echo "$$file" | sed -n -r -e 's/^gluon-$(call regex-escape,$(GLUON_SITE_CODE))-(.*)-$(call regex-escape,$(GLUON_$(profile)_MODEL_$(model)))-sysupgrade\.bin$$/\1/p')" \ + "$$(sha512sum "$$file" | awk '{print $$1}')" \ "$$file" && break; \ done; \ ) \ diff --git a/include/gluon.mk b/include/gluon.mk index affb8bd3..8f2df194 100644 --- a/include/gluon.mk +++ b/include/gluon.mk @@ -37,6 +37,8 @@ $(foreach var,$(2),$(1) := $$(sort $$(filter-out -% $$(patsubst -%,%,$$(filter - ) endef +regex-escape = $(shell echo '$(1)' | sed -e 's/[]\/()$*.^|[]/\\&/g') + GLUON_DEFAULT_PACKAGES := gluon-core kmod-ipv6 firewall ip6tables -uboot-envtools override DEFAULT_PACKAGES.router := diff --git a/include/profiles.mk b/include/profiles.mk index 32961479..f9424642 100644 --- a/include/profiles.mk +++ b/include/profiles.mk @@ -9,60 +9,60 @@ USB_PACKAGES := block-mount kmod-fs-ext4 kmod-fs-vfat kmod-usb-storage kmod-usb- # TL-WR740N v1, v3, v4 $(eval $(call GluonProfile,TLWR740)) -$(eval $(call GluonModel,TLWR740,tl-wr740n-v1,tp-link-tl-wr740n-nd-v1)) -$(eval $(call GluonModel,TLWR740,tl-wr740n-v3,tp-link-tl-wr740n-nd-v3)) -$(eval $(call GluonModel,TLWR740,tl-wr740n-v4,tp-link-tl-wr740n-nd-v4)) +$(eval $(call GluonModel,TLWR740,tl-wr740n-v1-squashfs,tp-link-tl-wr740n-nd-v1)) +$(eval $(call GluonModel,TLWR740,tl-wr740n-v3-squashfs,tp-link-tl-wr740n-nd-v3)) +$(eval $(call GluonModel,TLWR740,tl-wr740n-v4-squashfs,tp-link-tl-wr740n-nd-v4)) # TL-WR741N/ND v1, v2, v4 $(eval $(call GluonProfile,TLWR741)) -$(eval $(call GluonModel,TLWR741,tl-wr741nd-v1,tp-link-tl-wr741n-nd-v1)) -$(eval $(call GluonModel,TLWR741,tl-wr741nd-v2,tp-link-tl-wr741n-nd-v2)) -$(eval $(call GluonModel,TLWR741,tl-wr741nd-v4,tp-link-tl-wr741n-nd-v4)) +$(eval $(call GluonModel,TLWR741,tl-wr741nd-v1-squashfs,tp-link-tl-wr741n-nd-v1)) +$(eval $(call GluonModel,TLWR741,tl-wr741nd-v2-squashfs,tp-link-tl-wr741n-nd-v2)) +$(eval $(call GluonModel,TLWR741,tl-wr741nd-v4-squashfs,tp-link-tl-wr741n-nd-v4)) # TL-WR841N/ND v3, v5, v7, v8 $(eval $(call GluonProfile,TLWR841)) -$(eval $(call GluonModel,TLWR841,tl-wr841nd-v3,tp-link-tl-wr841n-nd-v3)) -$(eval $(call GluonModel,TLWR841,tl-wr841nd-v5,tp-link-tl-wr841n-nd-v5)) -$(eval $(call GluonModel,TLWR841,tl-wr841nd-v7,tp-link-tl-wr841n-nd-v7)) -$(eval $(call GluonModel,TLWR841,tl-wr841n-v8,tp-link-tl-wr841n-nd-v8)) +$(eval $(call GluonModel,TLWR841,tl-wr841nd-v3-squashfs,tp-link-tl-wr841n-nd-v3)) +$(eval $(call GluonModel,TLWR841,tl-wr841nd-v5-squashfs,tp-link-tl-wr841n-nd-v5)) +$(eval $(call GluonModel,TLWR841,tl-wr841nd-v7-squashfs,tp-link-tl-wr841n-nd-v7)) +$(eval $(call GluonModel,TLWR841,tl-wr841n-v8-squashfs,tp-link-tl-wr841n-nd-v8)) # TL-WR842N/ND v1 $(eval $(call GluonProfile,TLWR842,$(USB_PACKAGES))) -$(eval $(call GluonModel,TLWR842,tl-wr842n-v1,tp-link-tl-wr842n-nd-v1)) +$(eval $(call GluonModel,TLWR842,tl-wr842n-v1-squashfs,tp-link-tl-wr842n-nd-v1)) # TL-WR941N/ND v2, v3, v4 $(eval $(call GluonProfile,TLWR941)) -$(eval $(call GluonModel,TLWR941,tl-wr941nd-v2,tp-link-tl-wr941n-nd-v2)) -$(eval $(call GluonModel,TLWR941,tl-wr941nd-v3,tp-link-tl-wr941n-nd-v3)) -$(eval $(call GluonModel,TLWR941,tl-wr941nd-v4,tp-link-tl-wr941n-nd-v4)) +$(eval $(call GluonModel,TLWR941,tl-wr941nd-v2-squashfs,tp-link-tl-wr941n-nd-v2)) +$(eval $(call GluonModel,TLWR941,tl-wr941nd-v3-squashfs,tp-link-tl-wr941n-nd-v3)) +$(eval $(call GluonModel,TLWR941,tl-wr941nd-v4-squashfs,tp-link-tl-wr941n-nd-v4)) # TL-WR1043N/ND v1 $(eval $(call GluonProfile,TLWR1043,$(USB_PACKAGES))) -$(eval $(call GluonModel,TLWR1043,tl-wr1043nd-v1,tp-link-tl-wr1043n-nd-v1)) +$(eval $(call GluonModel,TLWR1043,tl-wr1043nd-v1-squashfs,tp-link-tl-wr1043n-nd-v1)) # TL-WDR3600/4300 v1 $(eval $(call GluonProfile,TLWDR4300,$(USB_PACKAGES))) -$(eval $(call GluonModel,TLWDR4300,tl-wdr3600-v1,tp-link-tl-wdr3600-v1)) -$(eval $(call GluonModel,TLWDR4300,tl-wdr4300-v1,tp-link-tl-wdr4300-v1)) +$(eval $(call GluonModel,TLWDR4300,tl-wdr3600-v1-squashfs,tp-link-tl-wdr3600-v1)) +$(eval $(call GluonModel,TLWDR4300,tl-wdr4300-v1-squashfs,tp-link-tl-wdr4300-v1)) # TL-MR3020 v1 $(eval $(call GluonProfile,TLMR3020,$(USB_PACKAGES))) -$(eval $(call GluonModel,TLMR3020,tl-mr3020-v1,tp-link-tl-mr3020)) +$(eval $(call GluonModel,TLMR3020,tl-mr3020-v1-squashfs,tp-link-tl-mr3020)) # TL-MR3040 v1 $(eval $(call GluonProfile,TLMR3040,$(USB_PACKAGES))) -$(eval $(call GluonModel,TLMR3040,tl-mr3040-v1,tp-link-tl-mr3040)) +$(eval $(call GluonModel,TLMR3040,tl-mr3040-v1-squashfs,tp-link-tl-mr3040)) # TL-MR3220 v1 $(eval $(call GluonProfile,TLMR3220,$(USB_PACKAGES))) -$(eval $(call GluonModel,TLMR3220,tl-mr3220-v1,tp-link-tl-mr3220)) +$(eval $(call GluonModel,TLMR3220,tl-mr3220-v1-squashfs,tp-link-tl-mr3220)) # TL-MR3420 v1 $(eval $(call GluonProfile,TLMR3420,$(USB_PACKAGES))) -$(eval $(call GluonModel,TLMR3420,tl-mr3420-v1,tp-link-tl-mr3420)) +$(eval $(call GluonModel,TLMR3420,tl-mr3420-v1-squashfs,tp-link-tl-mr3420)) ## Ubiquiti (everything) $(eval $(call GluonProfile,UBNT,$(USB_PACKAGES))) -$(eval $(call GluonModel,UBNT,ubnt-bullet-m,ubiquiti-bullet-m)) -$(eval $(call GluonModel,UBNT,ubnt-nano-m,ubiquiti-nanostation-m)) -$(eval $(call GluonModel,UBNT,ubnt-unifi,ubiquiti-unifi)) +$(eval $(call GluonModel,UBNT,ubnt-bullet-m-squashfs,ubiquiti-bullet-m)) +$(eval $(call GluonModel,UBNT,ubnt-nano-m-squashfs,ubiquiti-nanostation-m)) +$(eval $(call GluonModel,UBNT,ubnt-unifi-squashfs,ubiquiti-unifi))