diff --git a/Makefile b/Makefile index 579509b2..2442860d 100644 --- a/Makefile +++ b/Makefile @@ -5,13 +5,15 @@ include clean.mk include distro.mk +include profile.mk include iso.mk -# this could have come come from environment; +# this could have come from environment; # if not, can be symlinked if r/w, or made anew ifndef BUILDDIR BUILDDIR := $(shell realpath build || bin/mktmpdir mkimage-profiles.build) endif +export BUILDDIR # we can't use implicit rules for top-level targets, only for prereqs CONFIGS=$(shell sed -n 's,^distro/\([^:]\+\):.*$$,\1,p' distro.mk) @@ -21,16 +23,4 @@ all: @echo '** available distribution targets:' @echo $(DISTROS) | fmt -sw65 | column -t -prep: - @echo "** BUILDDIR: $(BUILDDIR)" -# ls -ld $(BUILDDIR) - @rsync -qaH --delete image.in/ "$(BUILDDIR)"/image/ - @rm -f "$(BUILDDIR)"/.config.mk - @touch "$(BUILDDIR)"/.config.mk - @mkdir "$(BUILDDIR)"/.mki - @rm -f build - @[ -w . ] \ - && ln -sf "$(BUILDDIR)" build \ - || echo "** profile directory readonly: skipping symlinks, env only" - -$(DISTROS): %.iso: | prep distro/% iso +$(DISTROS): %.iso: | profile/init distro/% profile/populate iso diff --git a/README b/README index 159faa0b..6f0c285d 100644 --- a/README +++ b/README @@ -1,12 +1,14 @@ -Объекты: -- дистрибутивы: distro.mk, могут основываться один на другом; - желательно избегать множественного наследования, используя - вместо него блоки use-* -- блоки функциональности use-*: не являются самостоятельными - (не путать с дистрибутивами), но законченными -- субпрофили: - + install2: инсталятор - + main: пакетная база к инсталяции (обязательная и дополнительная) +see also http://www.altlinux.org/Mkimage/Profiles/next + +п·п╠я┼п╣п╨я┌я▀: +- п╢п╦я│я┌я─п╦п╠я┐я┌п╦п╡я▀: distro.mk, п╪п╬пЁя┐я┌ п╬я│п╫п╬п╡я▀п╡п╟я┌я▄я│я▐ п╬п╢п╦п╫ п╫п╟ п╢я─я┐пЁп╬п╪; + п╤п╣п╩п╟я┌п╣п╩я▄п╫п╬ п╦п╥п╠п╣пЁп╟я┌я▄ п╪п╫п╬п╤п╣я│я┌п╡п╣п╫п╫п╬пЁп╬ п╫п╟я│п╩п╣п╢п╬п╡п╟п╫п╦я▐, п╦я│п©п╬п╩я▄п╥я┐я▐ + п╡п╪п╣я│я┌п╬ п╫п╣пЁп╬ п╠п╩п╬п╨п╦ use-* +- п╠п╩п╬п╨п╦ я└я┐п╫п╨я├п╦п╬п╫п╟п╩я▄п╫п╬я│я┌п╦ use-*: п╫п╣ я▐п╡п╩я▐я▌я┌я│я▐ я│п╟п╪п╬я│я┌п╬я▐я┌п╣п╩я▄п╫я▀п╪п╦ + (п╫п╣ п©я┐я┌п╟я┌я▄ я│ п╢п╦я│я┌я─п╦п╠я┐я┌п╦п╡п╟п╪п╦), п╫п╬ п╥п╟п╨п╬п╫я┤п╣п╫п╫я▀п╪п╦ +- я│я┐п╠п©я─п╬я└п╦п╩п╦: + + install2: п╦п╫я│я┌п╟п╩я▐я┌п╬я─ + + main: п©п╟п╨п╣я┌п╫п╟я▐ п╠п╟п╥п╟ п╨ п╦п╫я│я┌п╟п╩я▐я├п╦п╦ (п╬п╠я▐п╥п╟я┌п╣п╩я▄п╫п╟я▐ п╦ п╢п╬п©п╬п╩п╫п╦я┌п╣п╩я▄п╫п╟я▐) + ... -- списки пакетов: большая человеческая просьба по возможности - избегать дублирования +- я│п©п╦я│п╨п╦ п©п╟п╨п╣я┌п╬п╡: п╠п╬п╩я▄я┬п╟я▐ я┤п╣п╩п╬п╡п╣я┤п╣я│п╨п╟я▐ п©я─п╬я│я▄п╠п╟ п©п╬ п╡п╬п╥п╪п╬п╤п╫п╬я│я┌п╦ + п╦п╥п╠п╣пЁп╟я┌я▄ п╢я┐п╠п╩п╦я─п╬п╡п╟п╫п╦я▐ diff --git a/bin/tags2lists b/bin/tags2lists index 6962b6d6..e04ef311 100755 --- a/bin/tags2lists +++ b/bin/tags2lists @@ -9,7 +9,7 @@ # # TODO; consider s/-name/-path/ -[ -d pkg/lists ] && cd pkg/lists +[ -d pkg.in/lists ] && cd pkg.in/lists find ${1:-tagged} $(sed \ -e "s,\([^&|! ()']\+\),-name *_\1_*,g" \ diff --git a/clean.mk b/clean.mk index 4be39822..49bfec4d 100644 --- a/clean.mk +++ b/clean.mk @@ -1,12 +1,12 @@ clean: @echo '** cleaning up...' @[ -d build/ ] && \ - make -C build/image $@ GLOBAL_BUILDDIR=$(shell readlink build) \ + make -C build/ $@ GLOBAL_BUILDDIR=$(shell readlink build) \ ||: distclean: clean @[ -d build/ ] && \ - make -C build/image $@ GLOBAL_BUILDDIR=$(shell readlink build) && \ + make -C build/ $@ GLOBAL_BUILDDIR=$(shell readlink build) && \ rm -r $(shell readlink build) && \ rm build \ ||: diff --git a/configure b/configure index 51d3d135..136d3215 100755 --- a/configure +++ b/configure @@ -16,7 +16,7 @@ PARAMS="$@" #ls -ld $BUILDDIR #find image.in -type f -print0 | xargs -r0 cp -at "$BUILDDIR"/ -- -#rsync -qaH --delete image.in/ "$BUILDDIR"/image/ +#rsync -qaH --delete image.in/ "$BUILDDIR"/ #rm -f "$BUILDDIR"/.config.mk #touch "$BUILDDIR"/.config.mk #mkdir "$BUILDDIR"/.mki diff --git a/distro.mk b/distro.mk index 30aed18b..30bb7c91 100644 --- a/distro.mk +++ b/distro.mk @@ -1,6 +1,9 @@ -### build up distribution's configuration +# build up distribution's configuration CONFIG = $(BUILDDIR)/.config.mk +# source initial feature snippets +-include features.in/*/config.mk + # NB: don"t use ANY quotes ('/") for put() arguments! # shell will get confused by ' or args get spammed with " put = $(and $(1),$(put_body)) @@ -29,9 +32,12 @@ init: :> $(CONFIG) $(call put,KFLAVOUR=std-def) ### $(call put,IMAGE_INIT_LIST=+branding-$$(BRANDING)-release) + $(call put,BRANDING=altlinux-desktop) ### @#$(call put,STAGE1_PACKAGES=kernel-image-$$(KFLAVOUR)) $(call put,KERNEL_PACKAGES=kernel-image-$$(KFLAVOUR)) +distro/syslinux: init + # NB: our */* are phony targets really, just for namespace distro/installer: init sub/install2 @#$(call put,BRANDING=altlinux-sisyphus) ### @@ -47,9 +53,5 @@ distro/server-light: distro/server-base use/bootsplash $(call put,DISK_LISTS+=kernel-wifi) $(call put,BASE_LISTS+=$(call tags,base server)) -use/memtest86: - $(call put,COMMON_PACKAGES+=memtest86+) - @# configure syslinux/isolinux as well - use/bootsplash: $(call put,COMMON_TAGS+=bootsplash) diff --git a/features.in/Makefile b/features.in/Makefile new file mode 100644 index 00000000..6f1e1152 --- /dev/null +++ b/features.in/Makefile @@ -0,0 +1,19 @@ +include $(BUILDDIR)/.config.mk + +# make rsync backups +all: + for dir in $(FEATURES); do \ + for sub in $(SUBPROFILES); do \ + dest=$${sub%stage1}; \ + echo "dir/sub: [$$dir/$$sub/]" && \ + [ -d $$dir/$$sub/ ] && \ + echo rsync -ab $$dir/$$sub/ $(BUILDDIR)/$$dest/ && \ + rsync -ab $$dir/$$sub/ $(BUILDDIR)/$$dest/ && \ + cd $(BUILDDIR)/$$dest/ && \ + git add . && \ + git commit -qam "$@/$$dir/$$sub" && \ + cd ->&/dev/null; \ + done; \ + done; \ + find $(BUILDDIR) -name '*~' + @# these might signal of file clashes (or plain dirt) diff --git a/features.in/memtest/config.mk b/features.in/memtest/config.mk new file mode 100644 index 00000000..4b8bed64 --- /dev/null +++ b/features.in/memtest/config.mk @@ -0,0 +1,3 @@ +use/memtest86: + $(call put,COMMON_PACKAGES+=memtest86+) + @# configure syslinux/isolinux as well diff --git a/image.in/Makefile b/image.in/Makefile index eee09086..b3a19107 100644 --- a/image.in/Makefile +++ b/image.in/Makefile @@ -5,45 +5,33 @@ include $(GLOBAL_BUILDDIR)/.config.mk SUBDIRS = $(SUBPROFILES) -# we usually need a bootloader (until stage1 is separate), -# and "main" subprofile needs genbasedir -CHROOT_PACKAGES = syslinux apt-utils $(KERNEL_PACKAGES) - +# "main" subprofile needs genbasedir +CHROOT_PACKAGES = apt-utils ### -MKI_PACK_RESULTS = boot:mkimage-profiles.iso -COPY_TREE = ./isodata +MKI_PACK_RESULTS = isoboot:mkimage-profiles.iso +COPY_TREE = ./files BOOT_TYPE = isolinux -### -PROPAGATOR_VERSION = mkimage-profiles 2.0 -PROPAGATOR_MAR_MODULES = ./modules -PROPAGATOR_INITFS = ./initfs - include $(MKIMAGE_PREFIX)/targets.mk all: prep copy-tree copy-subdirs run-scripts pack-image -prep: initfs disk-info metadata +# FIXME: scripts.d/? +prep: disk-info metadata @echo "TOPDIR=$(TOPDIR)" -initfs: - echo "file /.VERSION @TMPDIR@/.VERSION 0644 0 0" >initfs - ### FIXME: broken test, we already do branding - [ -z "$(BRANDING)" ] || \ - echo "file /bootsplash /bootsplash/bootsplash 0644 0 0" >>initfs - disk-info: - mkdir -p isodata/.disk - echo "$(PROPAGATOR_VERSION)" >isodata/.disk/info ### +$(ARCH) - (cd $(TOPDIR); git show-ref --head --dereference -s -- HEAD 2>/dev/null) >isodata/.disk/commit - [ -s isodata/.disk/commit ] || rm isodata/.disk/commit + mkdir -p files/.disk + echo "$(PROPAGATOR_VERSION)" >files/.disk/info ### +$(ARCH) + (cd $(TOPDIR); git show-ref --head --dereference -s -- HEAD 2>/dev/null) >files/.disk/commit + [ -s files/.disk/commit ] || rm files/.disk/commit # see also alterator-pkg (backend3/pkg-install) -# FIXME: groups unmerged +# FIXME: groups unmerged, and only .base hardwired in metadata: - mkdir -p isodata/Metadata - rm -f isodata/Metadata/pkg-groups.tar - tar -cvf isodata/Metadata/pkg-groups.tar \ + mkdir -p files/Metadata + rm -f files/Metadata/pkg-groups.tar + tar -cvf files/Metadata/pkg-groups.tar \ -C $(PKGDIR) \ - $(shell echo $(call list,.base) $(call list,base) | sed 's,$(PKGDIR)/*,,g') + $(shell echo $(call list,.base) | sed 's,$(PKGDIR)/*,,g') diff --git a/image.in/isodata/syslinux/isolinux.cfg b/image.in/files/syslinux/isolinux.cfg similarity index 56% rename from image.in/isodata/syslinux/isolinux.cfg rename to image.in/files/syslinux/isolinux.cfg index 45a5ea13..558e5be7 100644 --- a/image.in/isodata/syslinux/isolinux.cfg +++ b/image.in/files/syslinux/isolinux.cfg @@ -1,21 +1,28 @@ -#default harddisk -default linux -prompt 1 +ui menu.c32 +menu title mkimage-profiles 2.0 +prompt 0 timeout 200 -gfxboot bootlogo -display boot.msg -implicit 1 +# f1 help.txt +# f2 version.txt +# ... +default rescue -#label harddisk -# localboot 0x80 +label harddisk + menu label Continue as usual + localboot 0x80 +# menu default label linux + menu label Normal install kernel alt0/vmlinuz append initrd=alt0/full.cz changedisk vga=0x314 quiet=1 showopts automatic=method:cdrom label noapic + menu label FailSafe(TM) install kernel alt0/vmlinuz append initrd=alt0/full.cz changedisk vga=0x314 showopts nolapic noapic acpi=off label rescue + menu label Rescue kernel alt0/vmlinuz append initrd=alt0/full.cz live fastboot stagename=rescue label memtest + menu label Memory Test kernel memtest diff --git a/image.in/functions.mk b/image.in/functions.mk index ceafcb96..4567b282 100644 --- a/image.in/functions.mk +++ b/image.in/functions.mk @@ -1,4 +1,4 @@ -PKGDIR=$(TOPDIR)/pkg +PKGDIR=$(GLOBAL_BUILDDIR)/pkg # prefix pkglist name with its directory to form a path list = $(1:%=$(PKGDIR)/lists/%) diff --git a/iso.mk b/iso.mk index 9db80398..b2f386b0 100644 --- a/iso.mk +++ b/iso.mk @@ -1,10 +1,6 @@ -pkgs: - @echo "** starting package lists build process" - $(MAKE) -C pkg BUILDDIR=$(BUILDDIR) - -iso: pkgs +iso: @echo "** starting image build process" @### setup GLOBAL_BOOT_TYPE, etc - (cd $(BUILDDIR)/image; autoconf; ./configure --with-aptconf=$(HOME)/apt/apt.conf) ### - $(MAKE) -C $(BUILDDIR)/image GLOBAL_BUILDDIR=$(BUILDDIR) + @#echo (cd $(BUILDDIR)/; autoconf; ./configure --with-aptconf=$(HOME)/apt/apt.conf) ### + @echo $(MAKE) -C $(BUILDDIR)/ GLOBAL_BUILDDIR=$(BUILDDIR) @# check iso size diff --git a/pkg/Makefile b/pkg.in/Makefile similarity index 100% rename from pkg/Makefile rename to pkg.in/Makefile diff --git a/pkg/lists/.base b/pkg.in/lists/.base similarity index 100% rename from pkg/lists/.base rename to pkg.in/lists/.base diff --git a/pkg/lists/Makefile b/pkg.in/lists/Makefile similarity index 100% rename from pkg/lists/Makefile rename to pkg.in/lists/Makefile diff --git a/pkg/lists/base b/pkg.in/lists/base similarity index 100% rename from pkg/lists/base rename to pkg.in/lists/base diff --git a/pkg/lists/kernel b/pkg.in/lists/kernel similarity index 100% rename from pkg/lists/kernel rename to pkg.in/lists/kernel diff --git a/pkg/lists/kernel-server b/pkg.in/lists/kernel-server similarity index 100% rename from pkg/lists/kernel-server rename to pkg.in/lists/kernel-server diff --git a/pkg/lists/kernel-wifi b/pkg.in/lists/kernel-wifi similarity index 100% rename from pkg/lists/kernel-wifi rename to pkg.in/lists/kernel-wifi diff --git a/pkg/lists/server-base b/pkg.in/lists/server-base similarity index 78% rename from pkg/lists/server-base rename to pkg.in/lists/server-base index e54553e3..5a891146 100644 --- a/pkg/lists/server-base +++ b/pkg.in/lists/server-base @@ -5,4 +5,5 @@ sfdisk mdadm openssh-server +openssh-blacklist acpid diff --git a/pkg/lists/tagged/_.base_alterator_install_ b/pkg.in/lists/tagged/_.base_alterator_install_ similarity index 100% rename from pkg/lists/tagged/_.base_alterator_install_ rename to pkg.in/lists/tagged/_.base_alterator_install_ diff --git a/pkg/lists/tagged/_.base_apt_ b/pkg.in/lists/tagged/_.base_apt_ similarity index 100% rename from pkg/lists/tagged/_.base_apt_ rename to pkg.in/lists/tagged/_.base_apt_ diff --git a/pkg/lists/tagged/_.base_kernel_ b/pkg.in/lists/tagged/_.base_kernel_ similarity index 100% rename from pkg/lists/tagged/_.base_kernel_ rename to pkg.in/lists/tagged/_.base_kernel_ diff --git a/pkg/lists/tagged/_base_compression_ b/pkg.in/lists/tagged/_base_compression_ similarity index 100% rename from pkg/lists/tagged/_base_compression_ rename to pkg.in/lists/tagged/_base_compression_ diff --git a/pkg/lists/tagged/_base_firmware_wireless_ b/pkg.in/lists/tagged/_base_firmware_wireless_ similarity index 100% rename from pkg/lists/tagged/_base_firmware_wireless_ rename to pkg.in/lists/tagged/_base_firmware_wireless_ diff --git a/pkg/lists/tagged/_base_server_disk_ b/pkg.in/lists/tagged/_base_server_disk_ similarity index 100% rename from pkg/lists/tagged/_base_server_disk_ rename to pkg.in/lists/tagged/_base_server_disk_ diff --git a/pkg/lists/tagged/_base_server_net_ b/pkg.in/lists/tagged/_base_server_net_ similarity index 100% rename from pkg/lists/tagged/_base_server_net_ rename to pkg.in/lists/tagged/_base_server_net_ diff --git a/pkg/lists/tagged/base-server.in b/pkg.in/lists/tagged/base-server.in similarity index 100% rename from pkg/lists/tagged/base-server.in rename to pkg.in/lists/tagged/base-server.in diff --git a/pkg/lists/tagged/server-light.in b/pkg.in/lists/tagged/server-light.in similarity index 100% rename from pkg/lists/tagged/server-light.in rename to pkg.in/lists/tagged/server-light.in diff --git a/pkg/lists/tagged/server.in b/pkg.in/lists/tagged/server.in similarity index 100% rename from pkg/lists/tagged/server.in rename to pkg.in/lists/tagged/server.in diff --git a/profile.mk b/profile.mk new file mode 100644 index 00000000..55177084 --- /dev/null +++ b/profile.mk @@ -0,0 +1,17 @@ +profile/init: + @echo "** BUILDDIR: $(BUILDDIR)" +# ls -ld $(BUILDDIR) + @rsync -qaH --delete image.in/ "$(BUILDDIR)"/ + @touch "$(BUILDDIR)"/.config.mk + @mkdir "$(BUILDDIR)"/.mki + cd $(BUILDDIR); git init ### + @rm -f build + @[ -w . ] \ + && ln -sf "$(BUILDDIR)" build \ + || echo "** profile directory readonly: skipping symlinks, env only" + +profile/populate: profile/init + for dir in sub.in features.in pkg.in; do \ + $(MAKE) -C $$dir; \ + done + diff --git a/sub.in/Makefile b/sub.in/Makefile new file mode 100644 index 00000000..b4682ce8 --- /dev/null +++ b/sub.in/Makefile @@ -0,0 +1,20 @@ +include $(BUILDDIR)/.config.mk + +all: + ls -l $(BUILDDIR)/.config.mk + echo -- SUBPROFILES: $(SUBPROFILES) + for dir in $(SUBPROFILES); do \ + echo -- rsync -a $$dir/ $(BUILDDIR)/$$dir/ && \ + rsync -a $$dir/ $(BUILDDIR)/$$dir/ && \ + cd $(BUILDDIR)/$$dir/ && \ + git add . && \ + git commit -qam "$@/$$dir"; \ + cd ->&/dev/null; \ + done + +clean: + for dir in $(SUBPROFILES); do \ + [ -n "$$dir" ] && \ + rm -rf $(BUILDDIR)/$$dir && \ + mkdir -p $(BUILDDIR)/$$dir ||:; \ + done diff --git a/image.in/install2/Makefile b/sub.in/install2/Makefile similarity index 100% rename from image.in/install2/Makefile rename to sub.in/install2/Makefile diff --git a/image.in/install2/image-scripts.d/50udev b/sub.in/install2/image-scripts.d/50udev similarity index 100% rename from image.in/install2/image-scripts.d/50udev rename to sub.in/install2/image-scripts.d/50udev diff --git a/image.in/install2/image-scripts.d/85cleanup-cjk b/sub.in/install2/image-scripts.d/85cleanup-cjk similarity index 100% rename from image.in/install2/image-scripts.d/85cleanup-cjk rename to sub.in/install2/image-scripts.d/85cleanup-cjk diff --git a/image.in/install2/image-scripts.d/90cleanup b/sub.in/install2/image-scripts.d/90cleanup similarity index 100% rename from image.in/install2/image-scripts.d/90cleanup rename to sub.in/install2/image-scripts.d/90cleanup diff --git a/image.in/install2/image-scripts.d/98system b/sub.in/install2/image-scripts.d/98system similarity index 100% rename from image.in/install2/image-scripts.d/98system rename to sub.in/install2/image-scripts.d/98system diff --git a/image.in/install2/image-scripts.d/99cleanupdb b/sub.in/install2/image-scripts.d/99cleanupdb similarity index 100% rename from image.in/install2/image-scripts.d/99cleanupdb rename to sub.in/install2/image-scripts.d/99cleanupdb diff --git a/image.in/install2/packages b/sub.in/install2/packages similarity index 100% rename from image.in/install2/packages rename to sub.in/install2/packages diff --git a/image.in/main/Makefile b/sub.in/main/Makefile similarity index 100% rename from image.in/main/Makefile rename to sub.in/main/Makefile diff --git a/sub.in/stage1/Makefile b/sub.in/stage1/Makefile new file mode 100644 index 00000000..5314d6a3 --- /dev/null +++ b/sub.in/stage1/Makefile @@ -0,0 +1,17 @@ +include globals.mk +include functions.mk +include $(MKIMAGE_PREFIX)/config.mk +include $(GLOBAL_BUILDDIR)/.config.mk + +CHROOT_PACKAGES = syslinux $(KERNEL_PACKAGES) + +### +MKI_PACK_RESULTS = data +PROPAGATOR_VERSION = mkimage-profiles 2.0 +PROPAGATOR_MAR_MODULES = ./modules +PROPAGATOR_INITFS = ./initfs + +include $(MKIMAGE_PREFIX)/targets.mk + +all: build-propagator copy-isolinux run-scripts pack-image + diff --git a/image.in/modules b/sub.in/stage1/modules similarity index 100% rename from image.in/modules rename to sub.in/stage1/modules diff --git a/sub.in/stage1/scripts.d/01-initfs b/sub.in/stage1/scripts.d/01-initfs new file mode 100644 index 00000000..a06f851f --- /dev/null +++ b/sub.in/stage1/scripts.d/01-initfs @@ -0,0 +1,6 @@ +#!/bin/sh +echo "file /.VERSION @TMPDIR@/.VERSION 0644 0 0" >"$WORKDIR"/initfs +### FIXME: broken test, we already do branding +[ -z "$(BRANDING)" ] || \ + echo "file /bootsplash /bootsplash/bootsplash 0644 0 0" >>"$WORKDIR"/initfs + diff --git a/sub.in/stage1/scripts.d/02-txtboot b/sub.in/stage1/scripts.d/02-txtboot new file mode 100755 index 00000000..3607fb91 --- /dev/null +++ b/sub.in/stage1/scripts.d/02-txtboot @@ -0,0 +1,2 @@ +#!/bin/sh +install -pDm644 /usr/lib/syslinux/menu.c32 "$WORKDIR"/syslinux/menu.c32