introduced conf.d/ for distro, ve config snippets

This was asked for by Leo-sp50 and torabora, and seems quite reasonable:
let's provide means to keep at least some distribution configurations
a bit apart, so that these can be considered more standalone in terms
of hard warranted functionality but at the same time enjoying the common
infrastructure.

Considering lib/distro.mk: it's now experimentally pulled apart so that
parallel development of different distro families can go on without
major merge hassles.  *Please* don't abuse with massive copy-paste.

And before you ask: this might get extended to allow for "private"
out-of-tree configurations being included since apparently there
are goals with no meaning outside of some very particular context...
but otherwise I'd like to encourage getting reusable bits in-tree.
This commit is contained in:
Michael Shigorin 2011-10-31 13:40:02 +03:00
parent 6a280d758d
commit e8306860f1
7 changed files with 75 additions and 69 deletions

View File

@ -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:'

17
conf.d/README Normal file
View File

@ -0,0 +1,17 @@
Этот каталог содержит включаемые фрагменты конфигурации образов с тем,
чтобы было удобнее параллельно разрабатывать специфические дистрибутивы
без излишних merge conflict'ов.
Следует понимать, что основная цель появления mkimage-profiles на свет
-- это уменьшение "форков" внутри семейства дистрибутивных профилей.
Поэтому при возможности следует всё-таки работать над общей базовой
частью, включая скриптовые хуки и списки пакетов, а также оптимизировать
граф зависимостей между дистрибутивными конфигурациями.
Попросту говоря, copy-paste -- тревожный признак.
NB: по переменным:
* $(VAR) подставляются перед их записью в $(CONFIG), который distcfg.mk;
* $$(VAR) раскрываются позже, при включении $(CONFIG) и востребовании
значений -- таким образом их значения могут изменяться до окончания
конфигурации, а также зависеть от значений других переменных.

13
conf.d/desktop.mk Normal file
View File

@ -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

8
conf.d/live.mk Normal file
View File

@ -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

30
conf.d/server.mk Normal file
View File

@ -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

View File

@ -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

View File

@ -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