diff --git a/Makefile b/Makefile index f1f06e0f..bf574a01 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,12 @@ +# --- here # 1. configure distro # 2. configure subprofiles, prepare package lists/groups and hooks -# 3. build subprofiles -# 4. build image +# --- in BUILDDIR +# 3. build subprofiles and subsequently image + +all help: + @echo '** available distribution targets:' + @echo $(DISTROS) | fmt -sw65 | column -t include clean.mk include distro.mk @@ -13,7 +18,6 @@ include iso.mk ifndef BUILDDIR BUILDDIR := $(shell realpath build || bin/mktmpdir mkimage-profiles.build) endif -export BUILDDIR ifdef DEBUG GLOBAL_VERBOSE ?= 1 @@ -21,11 +25,10 @@ SHELL += -x endif # we can't use implicit rules for top-level targets, only for prereqs -CONFIGS := $(shell sed -n 's,^distro/\([^:]\+\):.*$$,\1,p' distro.mk) +CONFIGS := $(shell sed -n 's,^distro/\([^:.]\+\):.*$$,\1,p' distro.mk) DISTROS := $(addsuffix .iso,$(CONFIGS)) +ARCH ?= $(shell arch | sed 's/i686/i586/') -all: - @echo '** available distribution targets:' - @echo $(DISTROS) | fmt -sw65 | column -t +export ARCH BUILDDIR DEBUG GLOBAL_VERBOSE SHELL $(DISTROS): %.iso: | profile/init distro/% boot/isolinux profile/populate iso diff --git a/README b/README index 93cdeb92..fd37ac35 100644 --- a/README +++ b/README @@ -1,7 +1,8 @@ see also http://www.altlinux.org/Mkimage/Profiles/next; -quickstart: -make distclean server-light.iso +quickstart: make distclean server-light.iso + +configurables: ~/.mkimage/metaconf.mk, see distro.mk Концепция: - метапрофиль служит репозиторием всего возможно нужного для @@ -9,7 +10,7 @@ make distclean server-light.iso итоговый дистрибутив Особенности: -- метапрофиль может быть полностью read-only +- метапрофиль может быть полностью read-only при сборке - для сборки подыскивается предпочтительно tmpfs - в профиль копируются только нужные объекты diff --git a/TODO b/TODO index ede8064e..e69de29b 100644 --- a/TODO +++ b/TODO @@ -1 +0,0 @@ -- кратко описать каждый субпрофиль и каждую фичу diff --git a/distro.mk b/distro.mk index c36e6543..28d147c8 100644 --- a/distro.mk +++ b/distro.mk @@ -24,17 +24,19 @@ include functions.mk sub/%: @$(call add,SUBPROFILES,$(@:sub/%=%)) -distro/init: +# initalize config from scratch, put some sane defaults in +distro/.init: @echo "** starting distro configuration build process" - @:> $(CONFIG) + @$(call try,MKIMAGE_PREFIX,/usr/share/mkimage) + @$(call try,GLOBAL_VERBOSE,) -distro/base: distro/init sub/stage1 use/syslinux use/syslinux/localboot.cfg +distro/.base: distro/.init sub/stage1 use/syslinux use/syslinux/localboot.cfg @$(call set,KFLAVOUR,std-def) @$(call set,IMAGE_INIT_LIST,+branding-$$(BRANDING)-release) @$(call set,BRANDING,altlinux-desktop) ### @$(call set,KERNEL_PACKAGES,kernel-image-$$(KFLAVOUR)) -distro/installer: distro/base sub/install2 use/syslinux/install2.cfg +distro/installer: distro/.base sub/install2 use/syslinux/install2.cfg @#$(call put,BRANDING=altlinux-sisyphus) ### @$(call set,BASE_LISTS,base kernel) @$(call set,INSTALL2_PACKAGES,installer-distro-server-light-stage2) ### @@ -51,9 +53,19 @@ distro/server-light: distro/server-base use/hdt @$(call add,GROUPS,ipmi mysql-server dhcp-server mail-server) @$(call add,GROUPS,monitoring diag-tools) -# bootloader test target -distro/syslinux: distro/base use/syslinux/ui-gfxboot \ - use/hdt use/memtest boot/isolinux +distro/minicd: distro/server-base + @$(call set,KFLAVOUR,std-ng) # we might need the most recent drivers + @$(call add,MAIN_PACKAGES,etcnet-full) + @$(call set,BRANDING,sisyphus-server-light) -boot/%: distro/init +# bootloader test target +distro/syslinux: distro/.base use/syslinux/ui-gfxboot use/hdt use/memtest + +# pick up release manager's config (TODO: distro-specific include as well?) +distro/.metaconf: + @if [ -s $(HOME)/.mkimage/metaconf.mk ]; then \ + $(call put,-include $(HOME)/.mkimage/metaconf.mk); \ + fi + +boot/%: distro/.init @$(call set,BOOTLOADER,$*) diff --git a/features.in/hdt/config.mk b/features.in/hdt/config.mk index 823d05d3..eeedcc6a 100644 --- a/features.in/hdt/config.mk +++ b/features.in/hdt/config.mk @@ -1,4 +1,5 @@ use/hdt: use/syslinux @$(call add,SYSLINUX_MODULES,hdt) - @$(call add,SYSLINUX_FILES,/usr/share/pci.ids) +# might be /usr/share/pci.ids if usig hwdatabase + @$(call add,SYSLINUX_FILES,/usr/share/misc/pci.ids) diff --git a/functions.mk b/functions.mk index 5f4569e5..314a4e22 100644 --- a/functions.mk +++ b/functions.mk @@ -11,7 +11,7 @@ define put_body printf '%s\n' '$(1)' >> "$(CONFIG)"; } endef -# these two take two args +# these three take two args # add() just appends an additive rule... add = $(and $(1),$(2),$(add_body)) define add_body @@ -20,15 +20,22 @@ printf '%s += %s\n' '$(1)' '$(2)' >> "$(CONFIG)"; } endef # ...set() comments out any previous definition -# and then appends an assigning rule +# and then appends an assigning rule... set = $(and $(1),$(2),$(set_body)) define set_body { $(log_body); \ -subst 's|^$(1)[ ]*+*=.*$$|#& # overridden by $@|' "$(CONFIG)"; \ +subst 's|^$(1)[ ]*[+?]*=.*$$|#& # overridden by $@|' "$(CONFIG)"; \ printf '%s = %s\n' '$(1)' '$(2)' >> "$(CONFIG)"; } endef -# is there a way to set a global make var from a recipe?.. +# try() appends a conditionally-assigning rule +try = $(and $(1),$(2),$(try_body)) +define try_body +{ $(log_body); \ +printf '%s ?= %s\n' '$(1)' '$(2)' >> "$(CONFIG)"; } +endef + +# if the rule being executed isn't logged yet, log it define log_body { grep -q '^# $@$$' "$(CONFIG)" || printf '# %s\n' '$@' >> "$(CONFIG)"; } endef diff --git a/image.in/Makefile b/image.in/Makefile index ca5ee7aa..fe1d37bc 100644 --- a/image.in/Makefile +++ b/image.in/Makefile @@ -1,7 +1,6 @@ -include globals.mk include functions.mk -include $(MKIMAGE_PREFIX)/config.mk include $(GLOBAL_BUILDDIR)/.config.mk +include $(MKIMAGE_PREFIX)/config.mk SUBDIRS = $(SUBPROFILES) @@ -12,13 +11,23 @@ MKI_PACK_RESULTS = isoboot:mkimage-profiles.iso COPY_TREE = ./files BOOT_TYPE = isolinux +ifeq "$(wildcard $(APTCONF))" "" +GLOBAL_HSH_APT_CONFIG = /etc/apt/apt.conf +else +GLOBAL_HSH_APT_CONFIG = $(APTCONF) +endif + include $(MKIMAGE_PREFIX)/targets.mk all: prep copy-subdirs copy-tree run-scripts pack-image # FIXME: scripts.d/? -prep: disk-info metadata +prep: debug disk-info metadata + +debug: @echo "TOPDIR=$(TOPDIR)" + @echo "ARCH=$(ARCH)" + @echo "GLOBAL_HSH_APT_CONFIG=$(GLOBAL_HSH_APT_CONFIG)" disk-info: @mkdir -p files/.disk diff --git a/image.in/configure.ac b/image.in/configure.ac deleted file mode 100644 index d0469bbf..00000000 --- a/image.in/configure.ac +++ /dev/null @@ -1,44 +0,0 @@ -AC_INIT( [mkimage-profiles], [0.1], [http://bugzilla.altlinux.org] ) - -AC_ARG_WITH(aptconf, - AC_HELP_STRING([--with-aptconf=file], - [custom apt.conf location, e.g '--with-aptconf=/home/me/apt.conf']), - [ - AC_MSG_CHECKING([apt.conf file]) - if test -r "$with_aptconf" ; then - APTCONF="$with_aptconf" - AC_MSG_RESULT([$with_aptconf exists]) - else - echo "WARNING: $with_aptconf missing, ignoring" - fi - ], - [ - APTCONF=/etc/apt/apt.conf - ]) - -AC_ARG_WITH(mkimage, - AC_HELP_STRING([--with-mkimage=dir], - [custom mkimage prefix, e.g '--with-mkimage=/home/me/usr/share/mkimage']), - [ - AC_MSG_CHECKING([mkimage]) - if test -d "$with_mkimage/tools"; then - MKIMAGE_PREFIX="$with_mkimage" - AC_MSG_RESULT([$with_mkimage/tools exists]) - fi - ], - [ - MKIMAGE_PREFIX='/usr/share/mkimage' - ]) - -# with-kernel: provide two separate desktop/server default substs? - -AC_SUBST(APTCONF) -AC_SUBST(MKIMAGE_PREFIX) - -AC_SUBST(DISTRO) -AC_SUBST(LABEL) -AC_CONFIG_FILES([ - globals.mk -]) - -AC_OUTPUT diff --git a/image.in/globals.mk.in b/image.in/globals.mk.in deleted file mode 100644 index 39611c96..00000000 --- a/image.in/globals.mk.in +++ /dev/null @@ -1,4 +0,0 @@ -export -MKIMAGE_PREFIX = @MKIMAGE_PREFIX@ -GLOBAL_HSH_APT_CONFIG = @APTCONF@ -GLOBAL_VERBOSE ?= 0 diff --git a/iso.mk b/iso.mk index 77e475f0..87dc396b 100644 --- a/iso.mk +++ b/iso.mk @@ -1,6 +1,8 @@ # adding boot/isolinux to prereqs is too late here, # since profile/populate has already finished by now +# +# NB: /usr/bin/{i586,x86_64} are setarch(8) symlinks + iso: @echo "** starting image build process" - @(cd $(BUILDDIR)/; autoconf; ./configure --with-aptconf=$(HOME)/apt/apt.conf) ### - $(MAKE) -C $(BUILDDIR)/ GLOBAL_BUILDDIR=$(BUILDDIR) + $(ARCH) $(MAKE) -C $(BUILDDIR)/ GLOBAL_BUILDDIR=$(BUILDDIR) diff --git a/pkg.in/lists/.base b/pkg.in/lists/.base index 61931362..7c79c917 100644 --- a/pkg.in/lists/.base +++ b/pkg.in/lists/.base @@ -1,5 +1,5 @@ basesystem -kernel-image-std-def +#kernel-image-std-def interactivesystem apt-conf-sisyphus diff --git a/pkg.in/lists/kernel-server b/pkg.in/lists/kernel-server index af09a290..fcb250c8 100644 --- a/pkg.in/lists/kernel-server +++ b/pkg.in/lists/kernel-server @@ -1 +1 @@ -kernel-modules-igb-std-def +#kernel-modules-igb-std-def diff --git a/profile.mk b/profile.mk index 747604bb..43c9d0ab 100644 --- a/profile.mk +++ b/profile.mk @@ -1,19 +1,21 @@ profile/init: @echo "** BUILDDIR: $(BUILDDIR)" @rsync -qaH --delete image.in/ "$(BUILDDIR)"/ - @touch "$(BUILDDIR)"/.config.mk - @mkdir "$(BUILDDIR)"/.mki + @:> "$(BUILDDIR)"/.config.mk + @mkdir "$(BUILDDIR)"/.mki # mkimage toplevel marker @type -t git >&/dev/null && \ cd $(BUILDDIR) && \ git init -q && \ git add . && \ git commit -qam 'init' @rm -f build - @[ -w . ] \ - && ln -sf "$(BUILDDIR)" build \ - || echo "** profile directory readonly: skipping symlinks, env only" + @if [ -w . ]; then \ + ln -sf "$(BUILDDIR)" build; \ + else \ + echo "** profile directory readonly: skipping symlinks, env only"; \ + fi -profile/populate: profile/init +profile/populate: profile/init distro/.metaconf @for dir in sub.in features.in pkg.in; do \ $(MAKE) -C $$dir; \ done diff --git a/sub.in/install2/Makefile b/sub.in/install2/Makefile index e6fd6084..ba509e7f 100644 --- a/sub.in/install2/Makefile +++ b/sub.in/install2/Makefile @@ -1,9 +1,8 @@ default: all -include ../globals.mk -include ../functions.mk -include $(MKIMAGE_PREFIX)/config.mk include $(GLOBAL_BUILDDIR)/.config.mk +include $(GLOBAL_BUILDDIR)/functions.mk +include $(MKIMAGE_PREFIX)/config.mk IMAGE_PACKAGES = $(KERNEL_PACKAGES) \ $(COMMON_PACKAGES) \ diff --git a/sub.in/install2/image-scripts.d/85cleanup-cjk b/sub.in/install2/image-scripts.d/85cleanup-cjk index cb8f79b6..06739759 100755 --- a/sub.in/install2/image-scripts.d/85cleanup-cjk +++ b/sub.in/install2/image-scripts.d/85cleanup-cjk @@ -1,27 +1,29 @@ #!/bin/sh # remove unused fonts -cd /usr/share/fonts/bitmap/misc/ -rm -f *ja.* *ko.* han* gb* jis* k14* rk* *rk.* *kana* cl* -rm -f *ISO* *JIS* *KOI* +cd /usr/share/fonts/bitmap/misc/ && + rm -f *ja.* *ko.* han* gb* jis* k14* rk* *rk.* *kana* cl* \ + *ISO* *JIS* *KOI* # TODO: sort out the rest of *x* # drop unneeded translation -cd /usr/share/qt4/translations/ -rm -f *_zh* *_ja* +cd /usr/share/qt4/translations/ && + rm -f *_zh* *_ja* # ...l10n... -cd /usr/share/X11/locale -rm -rf *[^C8]/ ja* ko* th* vi* zh* iso* +cd /usr/share/X11/locale && + rm -rf *[^C8]/ ja* ko* th* vi* zh* iso* # xkb -cd /usr/share/X11/xkb/symbols -rm -rf *_vndr jp kr th vn cn +cd /usr/share/X11/xkb/symbols && + rm -rf *_vndr jp kr th vn cn # gconv -cd /usr/lib*/gconv -rm -f CP* ISO* KOI* *JIS* T* HP* MAC* +cd /usr/lib*/gconv && + rm -f CP* ISO* KOI* *JIS* T* HP* MAC* # locales -cd /usr/lib*/locale -rm -rf ja_* ko_* th_* zh_* +cd /usr/lib*/locale && + rm -rf ja_* ko_* th_* zh_* + +: diff --git a/sub.in/main/Makefile b/sub.in/main/Makefile index ef62842d..e02e252e 100644 --- a/sub.in/main/Makefile +++ b/sub.in/main/Makefile @@ -2,16 +2,16 @@ default: all -include ../globals.mk -include ../functions.mk -include $(MKIMAGE_PREFIX)/config.mk include $(GLOBAL_BUILDDIR)/.config.mk +include $(GLOBAL_BUILDDIR)/functions.mk +include $(MKIMAGE_PREFIX)/config.mk CHROOT_PACKAGES = apt-utils rsync PACKAGES_EXPAND_METHOD=regexp # TODO: map() list() onto these -IMAGE_PACKAGES = $(call list,.base) \ +IMAGE_PACKAGES = $(KERNEL_PACKAGES) \ + $(call list,.base) \ $(COMMON_PACKAGES) \ $(MAIN_PACKAGES) \ $(call list,$(BASE_LISTS)) \ diff --git a/sub.in/stage1/Makefile b/sub.in/stage1/Makefile index 13c2fd45..0807a965 100644 --- a/sub.in/stage1/Makefile +++ b/sub.in/stage1/Makefile @@ -1,7 +1,6 @@ -include ../globals.mk -include ../functions.mk -include $(MKIMAGE_PREFIX)/config.mk include $(GLOBAL_BUILDDIR)/.config.mk +include $(GLOBAL_BUILDDIR)/functions.mk +include $(MKIMAGE_PREFIX)/config.mk CHROOT_PACKAGES = $(KERNEL_PACKAGES) $(STAGE1_PACKAGES) $(COMMON_PACKAGES)