added support for cpio and xz
Actually this is the proper rewrite that was looming ever since tgz support was introduced: there are multiple archive formats supported by mkimage, and there are multiple compression methods available as well. So the bullet got bitten yet again along with the "goal parser" which should be more straightforward by now. Thanks dkr@ and mithraen@ for the inspiration of this evening.
This commit is contained in:
parent
041d57542a
commit
7e78670e4b
14
Makefile
14
Makefile
@ -16,17 +16,15 @@ help:
|
||||
MKIMAGE_PROFILES = $(dir $(lastword $(MAKEFILE_LIST)))
|
||||
|
||||
# only process the first target (inter-target cleanup is tricky)
|
||||
IMAGE_TARGET := $(firstword $(MAKECMDGOALS))# distro/server-base.iso
|
||||
IMAGE_TARGET := $(firstword $(MAKECMDGOALS))# ve/generic.tar.gz
|
||||
ifeq (./,$(dir $(IMAGE_TARGET)))# convenience fallback
|
||||
IMAGE_TARGET := distro/$(IMAGE_TARGET)# for omitted "distro/"
|
||||
endif
|
||||
IMAGE_CONF := $(basename $(IMAGE_TARGET))# distro/server-base
|
||||
IMAGE_CLASS := $(dir $(IMAGE_TARGET))# distro/ (let's fix it)
|
||||
IMAGE_CLASS := $(IMAGE_CLASS:%/=%)# distro
|
||||
IMAGE_FILE := $(notdir $(IMAGE_TARGET))# server-base.iso
|
||||
IMAGE_NAME := $(basename $(IMAGE_FILE))# server-base
|
||||
IMAGE_TYPE := $(suffix $(IMAGE_FILE))# .iso (fix this too)
|
||||
IMAGE_TYPE := $(IMAGE_TYPE:.%=%)# iso
|
||||
IMAGE_CONF := $(firstword $(subst ., ,$(IMAGE_TARGET)))# ve/generic
|
||||
IMAGE_CLASS := $(firstword $(subst /, ,$(IMAGE_TARGET)))# ve
|
||||
IMAGE_FILE := $(lastword $(subst /, ,$(IMAGE_TARGET)))# generic.tar.gz
|
||||
IMAGE_NAME := $(firstword $(subst ., ,$(IMAGE_FILE)))# generic
|
||||
IMAGE_TYPE := $(subst $(IMAGE_NAME).,,$(IMAGE_FILE))# tar.gz
|
||||
|
||||
# preferences
|
||||
-include $(HOME)/.mkimage/profiles.mk
|
||||
|
@ -1,6 +1,12 @@
|
||||
# step 4: build the virtual environment image
|
||||
|
||||
ifeq (tar,$(IMAGE_PACKTYPE))
|
||||
MKI_TAR_COMPRESS = $(IMAGE_COMPRESS)
|
||||
endif
|
||||
|
||||
ifeq (cpio,$(IMAGE_PACKTYPE))
|
||||
MKI_CPIO_COMPRESS = $(IMAGE_COMPRESS)
|
||||
endif
|
||||
|
||||
IMAGE_PACKAGES = $(call list,$(BASE_LISTS)) \
|
||||
$(SYSTEM_PACKAGES) \
|
||||
|
@ -1,3 +1,4 @@
|
||||
Эта фича определяет формат упаковки создаваемого образа.
|
||||
На данный момент поддерживаются iso (загрузочный ISO9660
|
||||
для дистрибутивов) и tar/tgz (виртуальные окружения).
|
||||
для дистрибутивов) и tar/cpio с возможностью сжатия gz/xz
|
||||
(виртуальные окружения).
|
||||
|
@ -1,5 +1,4 @@
|
||||
DISTRO_EXTS := .iso
|
||||
VE_EXTS := .tar .tgz
|
||||
|
||||
use/pack:
|
||||
@$(call add_feature)
|
||||
@ -11,8 +10,25 @@ else
|
||||
@$(call set,IMAGE_PACKTYPE,isodata)
|
||||
endif
|
||||
|
||||
use/pack/tar: use/pack
|
||||
@$(call set,IMAGE_PACKTYPE,tar)
|
||||
VE_ARCHIVES := tar cpio
|
||||
VE_COMPRESSORS := gz xz# there's no sense in bzip2 by now
|
||||
VE_ZIPS := $(call addsuffices, \
|
||||
$(addprefix .,$(VE_COMPRESSORS)), \
|
||||
$(VE_ARCHIVES))# tar.gz cpio.xz ...
|
||||
VE_EXTS := $(sort $(addprefix .,$(VE_ARCHIVES) $(VE_ZIPS)))# .tar .tar.gz ...
|
||||
|
||||
use/pack/tgz: use/pack/tar
|
||||
@$(call set,IMAGE_COMPRESS,gzip)
|
||||
# generate rules for archive/compressor combinations
|
||||
define PACK_containers
|
||||
use/pack/$(1): use/pack
|
||||
@$$(call set,IMAGE_PACKTYPE,$(1))
|
||||
endef
|
||||
|
||||
define PACK_compressors
|
||||
use/pack/$(1).$(2): use/pack/$(1)
|
||||
@$$(call set,IMAGE_COMPRESS,$(2))
|
||||
endef
|
||||
|
||||
$(foreach c,$(VE_ARCHIVES), \
|
||||
$(eval $(call PACK_containers,$(c))) \
|
||||
$(foreach z,$(VE_COMPRESSORS), \
|
||||
$(eval $(call PACK_compressors,$(c),$(z)))))
|
||||
|
Loading…
Reference in New Issue
Block a user