diff --git a/Makefile b/Makefile index 1204a95a..96ac6e54 100644 --- a/Makefile +++ b/Makefile @@ -20,13 +20,18 @@ IMAGE_TYPE := $(IMAGE_TYPE:.%=%)# iso # most of the actual work done elsewhere include lib/*.mk +include conf.d/*.mk include features.in/*/config.mk +DISTRO_TARGETS := $(shell sed -n 's,^\(distro/[^:.]\+\):.*$$,\1,p' \ + lib/distro.mk $(wildcard conf.d/*.mk) | sort) +VE_TARGETS := $(shell sed -n 's,^\(ve/[^:.]\+\):.*$$,\1,p' \ + lib/ve.mk $(wildcard conf.d/*.mk) | sort) DISTROS := $(call addsuffices,$(DISTRO_EXTS),$(DISTRO_TARGETS)) VES := $(call addsuffices,$(VE_EXTS),$(VE_TARGETS)) IMAGES := $(DISTROS) $(VES) -.PHONY: $(IMAGES) +.PHONY: $(IMAGES) $(DISTRO_TARGETS) $(VE_TARGETS) help: @echo '** available distribution targets:' diff --git a/conf.d/README b/conf.d/README new file mode 100644 index 00000000..3df1adcd --- /dev/null +++ b/conf.d/README @@ -0,0 +1,17 @@ +Этот каталог содержит включаемые фрагменты конфигурации образов с тем, +чтобы было удобнее параллельно разрабатывать специфические дистрибутивы +без излишних merge conflict'ов. + +Следует понимать, что основная цель появления mkimage-profiles на свет +-- это уменьшение "форков" внутри семейства дистрибутивных профилей. +Поэтому при возможности следует всё-таки работать над общей базовой +частью, включая скриптовые хуки и списки пакетов, а также оптимизировать +граф зависимостей между дистрибутивными конфигурациями. + +Попросту говоря, copy-paste -- тревожный признак. + +NB: по переменным: +* $(VAR) подставляются перед их записью в $(CONFIG), который distcfg.mk; +* $$(VAR) раскрываются позже, при включении $(CONFIG) и востребовании + значений -- таким образом их значения могут изменяться до окончания + конфигурации, а также зависеть от значений других переменных. diff --git a/conf.d/desktop.mk b/conf.d/desktop.mk new file mode 100644 index 00000000..1986ae6f --- /dev/null +++ b/conf.d/desktop.mk @@ -0,0 +1,13 @@ +# desktop distributions +ifeq (distro,$(IMAGE_CLASS)) + +distro/desktop-base: distro/installer sub/main \ + use/syslinux/ui-vesamenu use/x11/xorg use/bootloader/grub + +distro/icewm: distro/desktop-base \ + use/lowmem use/x11/xdm use/x11/runlevel5 \ + use/bootloader/lilo use/powerbutton/acpi \ + use/cleanup/alterator + @$(call add,BASE_LISTS,$(call tags,icewm desktop)) + +endif diff --git a/conf.d/live.mk b/conf.d/live.mk new file mode 100644 index 00000000..91394fa5 --- /dev/null +++ b/conf.d/live.mk @@ -0,0 +1,8 @@ +# live images +ifeq (distro,$(IMAGE_CLASS)) + +distro/live: distro/.base use/live use/syslinux/ui-menu +distro/rescue: distro/.base use/rescue use/syslinux/ui-menu +distro/dos: distro/.init use/dos use/syslinux/ui-menu + +endif diff --git a/conf.d/server.mk b/conf.d/server.mk new file mode 100644 index 00000000..5eb0449a --- /dev/null +++ b/conf.d/server.mk @@ -0,0 +1,30 @@ +# server distributions +ifeq (distro,$(IMAGE_CLASS)) + +distro/server-base: distro/installer sub/main \ + use/syslinux/ui-menu use/memtest use/bootloader/grub + @$(call add,BASE_LISTS,server-base) + +distro/server-mini: distro/server-base use/cleanup/x11-alterator + @$(call set,KFLAVOURS,el-smp) + @$(call add,KMODULES,e1000e igb) + @$(call add,BASE_LISTS,\ + $(call tags,base && (server || network || security || pkg))) + @$(call add,BASE_LISTS,$(call tags,extra network)) + +distro/server-ovz: distro/server-base \ + use/hdt use/rescue use/firmware/server use/powerbutton/acpi \ + use/cleanup/x11-alterator + @$(call set,STAGE1_KFLAVOUR,std-def) + @$(call set,KFLAVOURS,std-def ovz-el) + @$(call add,KMODULES,bcmwl e1000e igb ndiswrapper rtl8168 rtl8192) + @$(call add,KMODULES,ipset ipt-netflow opendpi pf_ring xtables-addons) + @$(call add,KMODULES,drbd83 kvm) + @$(call add,BASE_LISTS,ovz-server) + @$(call add,BASE_LISTS,$(call tags,base server)) + @$(call add,MAIN_LISTS,kernel-wifi) + @$(call add,MAIN_GROUPS,dns-server http-server ftp-server kvm-server) + @$(call add,MAIN_GROUPS,ipmi mysql-server dhcp-server mail-server) + @$(call add,MAIN_GROUPS,monitoring diag-tools) + +endif diff --git a/lib/distro.mk b/lib/distro.mk index 8aedc6a4..0237f63e 100644 --- a/lib/distro.mk +++ b/lib/distro.mk @@ -4,15 +4,8 @@ ifndef MKIMAGE_PROFILES $(error this makefile is designed to be included in toplevel one) endif -# NB: distro/ targets should be defined in this file - -DISTRO_TARGETS := $(shell sed -n 's,^\(distro/[^:.]\+\):.*$$,\1,p' \ - $(lastword $(MAKEFILE_LIST)) | sort) - ifeq (distro,$(IMAGE_CLASS)) -.PHONY: $(DISTRO_TARGETS) - # request particular image subprofile inclusion sub/%: @$(call add,SUBPROFILES,$(@:sub/%=%)) @@ -35,63 +28,10 @@ distro/syslinux: distro/.init \ use/syslinux use/syslinux/localboot.cfg \ use/syslinux/ui-vesamenu use/hdt use/memtest -# live images - -distro/live: distro/.base use/live use/syslinux/ui-menu -distro/rescue: distro/.base use/rescue use/syslinux/ui-menu -distro/dos: distro/.init use/dos use/syslinux/ui-menu - -# $(VAR) will be substituted before writing them to $(CONFIG); -# $$(VAR) will remain unsubstituted until $(CONFIG) is included -# and their value requested (so the variable referenced -# can change its value during configuration _before_ -# it's actually used); just peek inside $(CONFIG) ;-) -# BASE_PACKAGES, BASE_LISTS, MAIN_PACKAGES, MAIN_LISTS: see sub.in/main/ - -# something actually useful (as a network-only installer) +# something marginally useful (as a network-only installer) # NB: doesn't carry stage3 thus cannot use/bootloader distro/installer: distro/.base use/install2 @$(call set,INSTALLER,altlinux-generic) @$(call set,STAGE1_KMODULES_REGEXP,drm.*) # for KMS -# server distributions - -distro/server-base: distro/installer sub/main \ - use/syslinux/ui-menu use/memtest use/bootloader/grub - @$(call add,BASE_LISTS,server-base) - -distro/server-mini: distro/server-base use/cleanup/x11-alterator - @$(call set,KFLAVOURS,el-smp) - @$(call add,KMODULES,e1000e igb) - @$(call add,BASE_LISTS,\ - $(call tags,base && (server || network || security || pkg))) - @$(call add,BASE_LISTS,$(call tags,extra network)) - -distro/server-ovz: distro/server-base \ - use/hdt use/rescue use/firmware/server use/powerbutton/acpi \ - use/cleanup/x11-alterator - @$(call set,STAGE1_KFLAVOUR,std-def) - @$(call set,KFLAVOURS,std-def ovz-el) - @$(call add,KMODULES,bcmwl e1000e igb ndiswrapper rtl8168 rtl8192) - @$(call add,KMODULES,ipset ipt-netflow opendpi pf_ring xtables-addons) - @$(call add,KMODULES,drbd83 kvm) - @$(call add,BASE_LISTS,ovz-server) - @$(call add,BASE_LISTS,$(call tags,base server)) - @$(call add,MAIN_LISTS,kernel-wifi) - @$(call add,MAIN_GROUPS,dns-server http-server ftp-server kvm-server) - @$(call add,MAIN_GROUPS,ipmi mysql-server dhcp-server mail-server) - @$(call add,MAIN_GROUPS,monitoring diag-tools) - -# desktop distributions - -distro/desktop-base: distro/installer sub/main \ - use/syslinux/ui-vesamenu use/x11/xorg use/bootloader/grub - -distro/icewm: distro/desktop-base \ - use/lowmem use/x11/xdm use/x11/runlevel5 \ - use/bootloader/lilo use/powerbutton/acpi \ - use/cleanup/alterator - @$(call add,BASE_LISTS,$(call tags,icewm desktop)) - -# NB: if there are too many screens above, it might make sense to distro.d/ endif diff --git a/lib/ve.mk b/lib/ve.mk index bf58d49d..e7c541e3 100644 --- a/lib/ve.mk +++ b/lib/ve.mk @@ -4,14 +4,8 @@ ifndef MKIMAGE_PROFILES $(error this makefile is designed to be included in toplevel one) endif -# NB: ve/ targets should be defined in this file -VE_TARGETS := $(shell sed -n 's,^\(ve/[^:.]\+\):.*$$,\1,p' \ - $(lastword $(MAKEFILE_LIST)) | sort) - ifeq (ve,$(IMAGE_CLASS)) -.PHONY: $(VE_TARGETS) - ve/.bare: profile/bare @$(call add,BASE_PACKAGES,basesystem) @@ -22,5 +16,4 @@ ve/generic: ve/.bare ve/openvpn: ve/.bare @$(call add,BASE_LISTS,$(call tags,server openvpn)) -# NB: if there are too many screens above, it might make sense to ve.d/ endif