Compare commits

..

27 Commits

Author SHA1 Message Date
Michael Shigorin
a91acf3de7 0.4.3-alt1
- enhancements to logging
- NICE variable: employ nice(1) and ionice(1) if available
- features.in/syslinux: banner tweaked to include target name
- features.in/live: set up unicode locale/consolefont
2011-11-07 00:06:54 +02:00
Michael Shigorin
ddf0c5b7c7 full-view docs update
- toplevel README received some long-needed refactoring
  + lowlevel detail moved, well, to lowlevel READMEs
- reflected more thoroughly that m-p is not about distros anymore
- dropped features.in/00example/README.en: it's already out-of-date
  a bit, and there's no perceived need in thorough English docs so far
- wiki article got split into parts and somewhat rewritten, links updated
- mv doc/{CodingStyle,style.txt}
2011-11-07 00:01:36 +02:00
Michael Shigorin
73f676f92c live: set up basic unicode locale
This only deals with console output (a text livecd doesn't ask
the user regarding the preferred language so far).

Refer to these discussions if needed:
https://bugzilla.altlinux.org/show_bug.cgi?id=25225
https://lists.altlinux.org/pipermail/devel-conf/2005-August/001785.html
2011-11-07 00:01:36 +02:00
Michael Shigorin
3c1bca535c downstream postprocessing symlinks tweaked
The bigger goal was being able to set up build in a way
that would allow for images (with configs and logs) be
deposited in per-IMAGE_NAME subdirectories of IMAGEDIR;
that's not done yet but a part of it is ready.

NB: in BUILDDIR, symlinking the just-built image is now
replaced with symlinking the IMAGEDIR since its location
is then predictable thus .gitignore-able for further work
on a generated profile, and more documentable as well.
It's not a hard change though, if you miss the image link
just drop me a note (or a commit).
2011-11-07 00:01:36 +02:00
Michael Shigorin
07fdc6dd9b further toplevel logging tweaks
Essentially some more polishing:
- image path extracted from downstream build log;
- extended error/warning regexp a bit so those with
  color grep options get even prettier output.

Notes:
- "1024" a magic number (briefly explained when introduced)
  moved to a sort of variable;
- "100 lines" for tail(1) is a rule-of-thumb taking into account
  typical amount of hasher/mkimage exhaust given GLOBAL_VERBOSE.
2011-11-07 00:01:36 +02:00
Michael Shigorin
cc8982dd7e tweaked variable logging
Preferences might be somewhat interesting too: while the official
ones shouldn't influence the build result at all, there's no whitelist
so all kinds of weirdness can be stuffed into local config in principle.
That should be diagnosable at least.
2011-11-07 00:01:36 +02:00
Michael Shigorin
cd3e47c562 introduced NICE variable
This one regulates the build wrapper: if the value is non-empty
then nice(1) and ionice(1) will be attempted so that the build
behaves better in regard to other tasks running on the system.

A few doc/variables.txt updates along the way.
2011-11-07 00:01:36 +02:00
Michael Shigorin
102aa3851d syslinux *.cfg: replace banner
Back then I didn't come up with anything smarter than
"mkimage-profiles 2.0" (with my tongue in a cheek),
but as m-p has grown up to 0.4 it's time to fix this.

When done properly, all of the string should be brandable
(with some sane default value inheriting from image name),
but let's do it at least bit by bit.
2011-11-07 00:01:36 +02:00
Michael Shigorin
30b1aa9be6 toplevel build report now timestamped
Thanks torabora@ for yet again seemingly obvious feature request
which strangely managed to evade implementation before.

On an afterthought, mass builds would suggest too much coffee
instead of a progress indicator -- so implemented the latter.

NB: the actual downstream-make-calling rule would expand the "naive"
$(shell date) too early: the rule is evaluated before starting its
execution, and as it's the time consuming one the shell evaluation
was in need, not make's.  The result is less generally available
(needs to be double quoted and won't work inside e.g. awk programs)
but way more precise.
2011-11-07 00:01:36 +02:00
Michael Shigorin
813571cb10 dump sources.list to build.log
The seemingly obvious feature was proposed by torabora@.
APTCONF complicates things a bit of course...
(and was slightly kludgy btw; fixed)
2011-11-07 00:01:36 +02:00
Michael Shigorin
67a7f68e79 .gear/mkimage-profiles.spec: initial package
Also added to the live-builder ISO which is now self-hosted
(sans full repo): one can build an image capable of rebuilding
itself (which is not that useful) and of building other goodies
on some temporarily unused RAM-filled hardware (which is the goal).
2011-11-07 00:01:36 +02:00
Michael Shigorin
83392012d4 live-builder distro: your self-hosted livecd
If you make distro/live-builder.iso, the result is an image
containing almost everything (short of actual full enough
repository) to rebuild itself.  It will attempt to configure
eth0 with DHCP and reach http://ftp.altlinux.org for packages.

RAM requirements start with 2Gb, self-build is accomplished
on a 4Gb host with "make CLEAN=1 distro/live-builder.iso".

Packages required for "make distro/syslinux.iso" get included.

(some due fixups all over the place too)
2011-11-06 17:36:09 +02:00
Michael Shigorin
b6438b9c8f bin/mktmpdir: lower the space bar
With not-that-recent mkimage-profiles development,
it's no longer apparent that at least a gigabyte
of free space is required to build something useful
(at least for the tests, like syslinux.iso).

In short, the guesser cutoff margin is now 256M.
2011-11-06 17:36:09 +02:00
Michael Shigorin
08de714970 added doc/apt.conf.sample
Unfortunately apt configuration is not straightforward at all
regarding being overridden: one can't just provide sources.list
but needs a corresponding apt.conf along with it, and that apt.conf
must disable the SysV-style snippet directories to avoid interesting
side effects of all the things getting overlaid.

So it's not surprising that torabora has asked for an example...
(thanks go to boyarsh@ since I asked him for an example long ago)
2011-11-04 16:54:41 +02:00
Michael Shigorin
895fae7d82 BELL support
Implemented opportunistic alarm support as proposed by torabora;
the actual result depends on readline and/or terminal settings
(read up on "visual bell" vs "audible bell" in case it's wrong).

TODO: this ought to be shifted downstream when proper logging
framework is there.
2011-11-04 16:54:41 +02:00
Michael Shigorin
e8306860f1 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.
2011-11-04 16:54:41 +02:00
Michael Shigorin
6a280d758d stage2-based debug fixup
Employed double colon targets to eliminate
  warning: ignoring old commands for target `debug'
2011-11-04 16:54:41 +02:00
Michael Shigorin
912d86c4af features.in/syslinux: tweak 00gfxboot.cfg
The same change as in m-p-d f1c5dd0 (discussed in #22486).
Seems it wasn't the culprit regarding the "BIOS won't boot
off this DVD" but is also recommended in README.gfxboot.
2011-11-04 16:54:41 +02:00
Michael Shigorin
812883facc features.in/syslinux: new 10removable.cfg
Borrowed from wmsmall iso by kostyalamer@.
2011-11-04 16:54:41 +02:00
Michael Shigorin
ace2ee1fc1 features.in/Makefile: fixups
src/dst tags might have been empty confusing tags2lists;
the current implementation is more robust (along with
slightly better debug within bin/tags2lists itself).

pushd/popd spam tamed too (replaced by nice log messages).
2011-11-04 16:54:41 +02:00
Michael Shigorin
0a8490ad7f logging tweaks for better readability
...and create a symlink to a just-built image from builddir too.
2011-11-04 16:54:41 +02:00
Michael Shigorin
77115ff50b image.in/functions.mk: added ARCH dup
If the build is (re-)run withing generated profile directory,
the makefiles no longer have ARCH passed by upstream -- the
upstream might be unreachable at that point indeed.

This is unfortunate but we should cope with that.

NB: might be revisited when architecture-specific packagelists emerge
since currently there's no difference in package lists so we can just
re-run the build for a different architecture but this might change...
2011-11-04 16:54:41 +02:00
Michael Shigorin
7919df829c avoid "nothing to commit" in build.log
Typical (to-be-refactored when having settled down)
"cd/git .../cd -" sequences are tweaked to safeguard
against changing back without having actually changed to,
just in case.

features.in/Makefile left with pushd/popd due to its
three-level diving course (which somewhat asks to be
refactores in functions either but is intrinsically
somewhat complex OTOH).
2011-11-04 16:54:41 +02:00
Michael Shigorin
d5a5941f96 official {distro,ve}/* support
This is quite a large-scale change since mkimage-profiles got used to
baking distributions over the last year, and virtual environments are
quite different, so e.g. image.in/Makefile had to be split in two with
the main part of it moved into features.in/iso/lib/.

Short overview:

- features.in/Makefile: lib/ support
  (supporting VE images requires dynamic modifications
  to image.in/Makefile before starting the build;
  the most natural way to achieve that seems to use
  features mechanism along with makefile include dir)

- packaging format related part moved into features.in/pack
  (should be better prepared for diversity either)
- features.in/iso renamed to features.in/build-distro
- features.in/ve  renamed to features.in/build-ve
  + NB: these could not be merged as e.g. features.in/build
    due to completely different script hooks

- lib/image.mk renamed to lib/build.mk
- image, config, log postprocessing moved downstream
- added a sort of a topping in the form of lib/sugar.mk
- assorted style fixups (like ifeq usage)

- clean.mk: reliability fix (the problem was observed by Oleg Ivanov
  and me too but finally it did get the attention quantum)

- reviewed, updated and extended docs
  + QUICKSTART: should be[come] a step-by-step guide
    (thanks Leo-sp50 for prodiving feedback)
2011-11-04 16:54:41 +02:00
Michael Shigorin
720a579690 wash, rinse, repeat
install2 cleanups:

- functionally indifferent ones: particularly, install2/*/98system's
  "mkdir -p /image" was superfluous as it was done by that time already
  by sub.in/stage2/image-scripts.d/00stage1

- taken apart, prepared for tags: so far it's a mostly moot change
  since the installer cleanup scripts themselves are mostly the same as
  preceding 90cleanup was (with some additions corresponding to recent
  kernel development); it's still unclear what the mechanism for
  configuring the cleanups in effect will be, either directory/package
  regex lists or tagged scripts excluded from execution by yet another tag

fixes:

- image.in/Makefile: fix metadata related test; the actual test was
  assuming that stage1 kernel means installer, which is not the case
  since generic stage2 introduction; oh well

- 85cleanup-lowmem: a "_" too much was the culprit in destroying the
  needed translations along with those deemed superfluous; thanks go to
  Oleg Ivanov and Lenar Shakirov for finding the bug and proposing the
  fix altogether

additions:

- features.in/Makefile: reworked help target; it was rather inaccessible
  due to BUILDDIR normally undefined at the time of direct make
  invocation, and BUILDDIR is normally defined during normal builds
  anyways so let's try it this way.

- README++

daydreams:

- 01-genbasedir: we should drop bzip2 compressed pkglists some day
  but see genbasedir and apt-cdrom first, 90-pkg.sh (alterator-pkg)
  will fail miserably otherwise
2011-11-04 16:15:31 +02:00
Michael Shigorin
b474bff468 iso.mk: low space hint on build failure
Just in case the build.log will be inobvious, and it's easy to diagnose
automatically.  Thanks Andrey Stroganov for this use case.

Thanks for improving the initial implementation go to raorn@ for kind
commit lynch and to Yuri Bushmelev for actually suggesting something
more concise.

BTW the "1024" magic number was taken out of thin air:
the "no free space" errors are most likely to happen while
forming/populating a chroot (apt/rpm errors out) and chroots are
roughly two orders of magnitude heftier than a megabyte.
2011-11-04 16:15:31 +02:00
Michael Shigorin
368cfd26bd syslinux: trivial cleanup
"echo ... | xargs cp -t" is a bit more complicated
compared to plain "copy ..."
2011-11-04 16:15:31 +02:00
101 changed files with 1163 additions and 627 deletions

View File

@@ -0,0 +1,68 @@
Name: mkimage-profiles
Version: 0.4.3
Release: alt1
Summary: ALT Linux based distribution metaprofile
License: GPLv2+
Group: Development/Other
Url: http://www.altlinux.org/Mkimage/Profiles/next
Source: %name-%version.tar
Packager: Michael Shigorin <mike@altlinux.org>
BuildArch: noarch
Requires: rsync git-core
Requires: time schedutils
%define mpdir %_datadir/%name
%add_findreq_skiplist %mpdir/*.in/*
%description
mkimage-profiles is a collection of bits and pieces useful for
distributions construction: it contains package lists, features,
and whole subprofiles (like "rescue" building block) for you
to choose from, and some ready-made image recipes as well.
Make no mistake: constructing distributions isn't just fun, it takes
a lot of passion and knowledge to produce a non-trivial one. So m-p
(the short nick for mkimage-profiles) is complex too. If you need
-- or want -- to make just a few tweaks to an existing recipe, it might
be easier to comprehend the generated profile (aka builddir) which
contains only the needed subprofiles, script hooks and package lists
and is way more compact.
Virtual environment template caches (OpenVZ/LXC) can be made either.
In short, setup hasher (http://en.altlinux.org/hasher) and here we go:
cd %mpdir
head README
make distro/syslinux.iso
But if you're into regular distro hacking and are not afraid of make
and modest metaprogramming (some code generation and introspection),
welcome to the metaprofile itself; read the docs and get the git:
%url
%prep
%setup
%build
%install
mkdir -p %buildroot%mpdir
cp -a * %buildroot%mpdir
%files
%mpdir/*
%doc doc/
%doc README QUICKSTART
%changelog
* Mon Nov 07 2011 Michael Shigorin <mike@altlinux.org> 0.4.3-alt1
- enhancements to logging
- NICE variable: employ nice(1) and ionice(1) if available
- features.in/syslinux: banner tweaked to include target name
- features.in/live: set up unicode locale/consolefont
* Wed Nov 02 2011 Michael Shigorin <mike@altlinux.org> 0.4.2-alt1
- initial package

2
.gear/rules Normal file
View File

@@ -0,0 +1,2 @@
spec: .gear/mkimage-profiles.spec
tar: v@version@:.

View File

@@ -2,50 +2,70 @@
# --- here
# 1. initialize new profile (BUILDDIR) as a copy of image.in/
# 2. configure distro
# 3. copy subprofiles, script hooks, and package lists/groups
# from metaprofile to new profile (as needed)
# 3. copy the needed bits from metaprofile to a new profile
# --- in BUILDDIR
# 4. build subprofiles and subsequently the image
# 4. build subprofiles and subsequently an image
all help:
@echo '** available distribution targets:'
@echo $(IMAGES) | fmt -sw"$$((COLUMNS>>1))" | column -t
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_CONF := $(basename $(MAKECMDGOALS))# 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
# preferences
-include $(HOME)/.mkimage/profiles.mk
# most of the actual work done elsewhere
include clean.mk
include profile.mk
include distro.mk
include log.mk
include iso.mk
include lib/*.mk
include conf.d/*.mk
include features.in/*/config.mk
.PHONY: $(IMAGES)
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)
# we can't use implicit rules for top-level targets, only for prereqs
# NB: what about static pattern rules?
# TODO: move into libdistro?
DISTROS := $(shell sed -n 's,^distro/\([^:.]\+\):.*$$,\1,p' distro.mk)
IMAGES := $(addsuffix .iso,$(DISTROS))
.PHONY: $(IMAGES) $(DISTRO_TARGETS) $(VE_TARGETS)
# to be passed into distcfg.mk
IMAGEDIR ?= $(shell [ -d "$$HOME/out" -a -w "$$HOME/out" ] \
&& echo "$$HOME/out" \
|| echo "$(BUILDDIR)/out" )
IMAGENAME ?= mkimage-profiles-$(ARCH).iso
help:
@echo '** available distribution targets:'
@echo $(DISTROS) | fmt -sw"$$((COLUMNS>>1))" | column -t
@echo
@echo '** available virtual environment targets:'
@echo $(VES) | fmt -sw"$$((COLUMNS>>1))" | column -t
everything:
@for i in $(IMAGES); do $(MAKE) BUILDDIR=$(BUILDDIR) $$i; done
### suboptimal but at least clear, reliable and convenient
all:
@n=1; sum=$(words $(DISTROS)); \
for distro in $(DISTROS); do \
echo "** building $$distro:"; \
$(MAKE) --no-print-directory \
ALL=$$n/$$sum \
BUILDDIR=$(BUILDDIR) \
$$distro; \
echo; \
n=$$(($$n+1)); \
done
$(IMAGES): %.iso: | profile/init distro/% boot/isolinux profile/populate iso
@# TODO: run automated tests (e.g. iso size)
@OUTNAME="$(@:.iso=)-$(DATE)-$(ARCH).iso"; \
OUTPATH="$(IMAGEDIR)/$$OUTNAME"; \
mkdir -p "$(IMAGEDIR)" && \
test -s "$(IMAGEDIR)/$(IMAGENAME)" && \
mv "$(IMAGEDIR)/$(IMAGENAME)" "$$OUTPATH" && \
echo "** image: $$OUTPATH" && \
ln -sf "$$OUTNAME" "$(IMAGEDIR)/$@" && \
ln -sf "$@" "$(IMAGEDIR)/mkimage-profiles.iso"; \
if [ -n "$(DEBUG)" ]; then \
cp -a "$(BUILDLOG)" "$$OUTPATH.log"; \
cp -a "$(CONFIG)" "$$OUTPATH.cfg"; \
fi
$(IMAGES): debug \
config/with/$(IMAGE_CONF) \
config/like/$(IMAGE_CLASS) \
config/name/$(IMAGE_NAME) \
config/pack/$(IMAGE_TYPE) \
build; @:
debug:
ifeq (2,$(DEBUG))
@$(foreach v,\
$(filter IMAGE_%,$(sort $(.VARIABLES))),\
$(warning $v = $($v)))
endif

33
QUICKSTART Normal file
View File

@@ -0,0 +1,33 @@
требуется
~~~~~~~~~
- ALT Linux 6.0 или выше (возможна адаптация "вниз")
- установленный mkimage (свежий, как и hasher)
- пользователь с правом запуска hasher
полезно
~~~~~~~
- смонтированный tmpfs на несколько гигабайт
+ например, в /tmp или /home/USER/hasher
+ каталог из prefix в /etc/hasher-priv/system
- установленный git-core
- настроенный ~/.gitconfig
команды
~~~~~~~
- от имени root:
# apt-get install hasher git-core
# hasher-useradd USER
- от имени пользователя (после повторного входа):
$ git config --global user.email "my@email"
$ git config --global user.name "My Name"
- тестовая сборка (см. тж. lib/distro.mk, doc/variables.txt):
$ make distro/icewm.iso
ссылки
~~~~~~
- http://www.altlinux.org/tmpfs
- http://www.altlinux.org/hasher
- http://www.altlinux.org/mkimage
- http://www.altlinux.org/Mkimage/Profiles/m-p

67
README
View File

@@ -1,19 +1,23 @@
see also http://www.altlinux.org/Mkimage/Profiles/next
Welcome to mkimage-profiles!
quickstart: make server-base.iso
(NB: requires configured http://en.altlinux.org/Hasher)
English quickstart: make distro/server-base.iso;
see http://en.altlinux.org/Hasher (and a large tmpfs).
configurables: ~/.mkimage/profiles.mk,
Configurables: ~/.mkimage/profiles.mk;
see doc/profiles.mk.sample and libdistro.mk
license: GPLv2+, see COPYING
License: GPLv2+, see COPYING.
Most docs are in Russian, welcome to learn it or ask for English.
См. тж. http://www.altlinux.org/Mkimage/Profiles/m-p
Задача:
- конфигурирование и создание образов на базе ALT Linux
Концепция:
- конфигурация, как и образ -- объект постадийной сборки
- метапрофиль служит репозиторием для построения индивидуального
профиля, по которому создаётся итоговый дистрибутив
- для одноразовых модификаций можно подправить сгенерированный
профиль, для долгосрочной разработки стоит вливать правки
в метапрофиль (что требует больше навыков и времени)
профиля, по которому создаётся итоговый образ
Особенности:
- метапрофиль может быть полностью read-only при сборке
@@ -22,49 +26,36 @@ license: GPLv2+, see COPYING
он автономен относительно метапрофиля
Стадии работы:
- инициализация дистрибутивного профиля
- сборка конфигурации дистрибутива
- наполнение дистрибутивного профиля
- сборка дистрибутива
- инициализация сборочного профиля
- сборка конфигурации образа
- наполнение сборочного профиля
- сборка образа
Объекты:
- дистрибутивы:
+ описываются в distro.mk
+ могут основываться один на другом
+ включают один или более субпрофилей по надобности
- дистрибутивы и виртуальные окружения:
+ описываются в conf.d/*.mk или соответственно lib/{distro,ve}.mk
+ могут основываться одно на другом
+ дистрибутивы также:
- включают один или более субпрофилей по надобности
+ желательно избегать множественного наследования, см. тж. фичи
- субпрофили:
+ список собирается в $(SUBPROFILES)
+ базовые комплекты помещены в подкаталогах под sub.in/;
их наборы скриптов могут расширяться фичами
- stage1: propagator, ядро инсталятора и initrd в т.ч. с firmware
- stage2: базовый live-образ (и модули ядра, соответствующие stage1);
используется только с модификаторами (см. соответствующие фичи):
+ stage2/install2: инсталятор
+ stage2/live: LiveCD
+ stage2/rescue: спасательная система
- main: пакетная база к инсталяции (обязательная и дополнительная)
- фичи:
+ список собирается в $(FEATURES)
+ законченные блоки функциональности (или наборы таковых)
+ описываются в индивидуальных features.in/*/config.mk
+ могут зависеть друг от друга и требовать субпрофили
+ могут требовать другие фичи, а также субпрофили
+ при сборке $(BUILDDIR) содержимое указанных в $(FEATURES) фич
(подкаталоги, соответствующие входящим в дистрибутив субпрофилям
под их итоговыми названиями -- например, live, а не stage2/live)
добавляется в профиль; затем выполняются generate.sh, generate.mk
- списки пакетов (*_LISTS): просьба по возможности избегать дублирования
NB: перечисленные в этих переменных файлы автоматически копируются
в порождаемый профиль => не следует указывать пакаджлисты напрямую
- индивидуальные пакеты (*_PACKAGES): следует крайне осторожно пользоваться
SYSTEM_PACKAGES -- эти пакеты попадут во все стадии, в том числе в образ
чувствительной к объёму install2 (в stage1 -- только в инструментальный
чрут); применяйте для того, что обязано быть и в инсталяторе, и в готовой
системе -- и не путайте с COMMON_PACKAGES (main, live, rescue)
добавляется в профиль с постобработкой (generate.*)
- списки пакетов (*_LISTS):
+ просьба по возможности избегать дублирования
- индивидуальные пакеты (*_PACKAGES): см. тж. conf.d/README
Результат:
- при успешном завершении сборки образ называется сообразно
дистрибутиву и укладывается в $(IMAGEDIR):
- при успешном завершении сборки образ называется по имени цели
и укладывается в $(IMAGEDIR):
+ указанный явно,
+ либо ~/out/ (если возможно),
+ или $(BUILDDIR)/out/ иначе

View File

@@ -3,9 +3,9 @@
# hope there aren't spaces in RM's $HOME are they?
DIRS="$TMP $TMPDIR $HOME/hasher /tmp /var/tmp"
MINSIZE=1048576 # face control criterion
MINSIZE=262144 # face control criterion
# pick existing, writeable, >1Gb free space dirs
# pick existing, writeable, >256M free space dirs
# rank them wrt type: tmpfs > realfs > rootfs
choose_tmpdir() {
for i in $DIRS; do
@@ -26,4 +26,4 @@ choose_tmpdir() {
}
DIR="`choose_tmpdir`"
mktemp -d "${1:-tmpdir}.XXXXXXXXXX" --tmpdir="${DIR:-..}"
mktemp -d "${1:-tmpdir}.XXXXXXX" --tmpdir="${DIR:-`realpath ..`}"

View File

@@ -29,4 +29,5 @@ transformed="$(sed \
-e "s, *( *, ( ,g" \
-e "s, *) *, ) ,g")"
[ "$DEBUG" = 2 ] && echo "`basename $0`: transformed = \"$transformed\"" >&2
[ -z "$transformed" ] || find $transformed | sed 's,^\./,,'

24
conf.d/README Normal file
View File

@@ -0,0 +1,24 @@
Этот каталог содержит включаемые фрагменты конфигурации образов с тем,
чтобы было удобнее параллельно разрабатывать специфические дистрибутивы
и VE без излишних merge conflict'ов.
Следует понимать, что основная цель появления mkimage-profiles на свет
-- это уменьшение "форков" внутри семейства дистрибутивных профилей.
Поэтому при возможности следует всё-таки работать над общей базовой
частью, включая скриптовые хуки и списки пакетов, а также оптимизировать
граф зависимостей между конфигурациями образов.
Попросту говоря, copy-paste -- тревожный признак.
По переменным:
* SYSTEM_PACKAGES стоит применять крайне осторожно -- эти пакеты попадут
во все стадии, в том числе в образ чувствительной к объёму install2
(в stage1 -- только в инструментальный чрут); применяйте для того,
что обязано быть и в инсталяторе, и в готовой системе;
* для "обычного общего" (main, live, rescue) есть COMMON_PACKAGES.
По подстановкам:
* $(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

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

@@ -0,0 +1,21 @@
# live images
ifeq (distro,$(IMAGE_CLASS))
distro/live: distro/.base use/live/base
distro/rescue: distro/.base use/rescue use/syslinux/ui-menu
distro/dos: distro/.init use/dos use/syslinux/ui-menu
distro/live-builder: distro/.base sub/main \
use/live/base use/dev/mkimage
@$(call add,LIVE_LISTS,$(call tags,base && (server || builder)))
@$(call add,LIVE_PACKAGES,livecd-tmpfs livecd-online-repo)
@$(call add,LIVE_PACKAGES,mkimage-profiles)
@$(call add,LIVE_PACKAGES,zsh sudo apt-repo)
@$(call add,MAIN_PACKAGES,rpm-build basesystem)
@$(call add,MAIN_PACKAGES,fakeroot sisyphus_check)
@$(call add,MAIN_PACKAGES,syslinux pciids memtest86+ mkisofs)
@$(call add,MAIN_PACKAGES,file make-initrd make-initrd-propagator)
@$(call add,MAIN_PACKAGES,livecd-tmpfs livecd-online-repo)
@$(call add,MAIN_PACKAGES,mkimage-profiles)
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

@@ -1,86 +0,0 @@
# this makefile is designed to be included in toplevel one
ifndef BUILDDIR
$(error BUILDDIR not defined)
endif
# step 2: build up distribution's configuration
# NB: distro/ targets should be defined in this file,
# see toplevel Makefile's $(DISTROS) assignment
CONFIG = $(BUILDDIR)/distcfg.mk
# collect use/% (source initial feature snippets)
-include features.in/*/config.mk
# put(), add(), set(), try(), tags():
# package list names are considered relative to pkg/lists/;
# tags can do boolean expressions: (tag1 && !(tag2 || tag3))
include functions.mk
# distro/.%, sub/.%, boot/%
include libdistro.mk
# bootloader test target; requires recent mkimage to build
distro/syslinux: distro/.init distro/.branding sub/stage1 \
use/syslinux use/syslinux/localboot.cfg \
use/syslinux/ui-vesamenu use/hdt use/memtest use/dos
# $(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/
# live images
distro/live: distro/.base use/live use/syslinux/ui-menu
distro/rescue: distro/.base use/rescue use/syslinux/ui-menu
distro/dos: sub/stage1 use/dos use/syslinux/ui-menu
# something actually 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/

8
doc/apt.conf.sample Normal file
View File

@@ -0,0 +1,8 @@
// these must be unset to avoid picking up
// /etc/apt/{apt.conf.d,sources.list.d,}/
Dir::Etc::main "/dev/null";
Dir::Etc::parts "/var/empty";
Dir::Etc::SourceParts "/var/empty";
// this is what caused the whole trouble
Dir::Etc::sourcelist "/home/mike/apt/sources.list";

View File

@@ -27,3 +27,8 @@
- features.in/syslinux/scripts.d/20-propagator-ramdisk
+ ожидают, что названия squashfs-образов второй стадии инсталятора,
livecd и спасательной системы соответственно altinst, live и rescue
- image.in/Makefile
+ ожидает, что конфигурация будет в distcfg.mk (см. тж. lib/profile.mk),
а лог сборки -- в build.log (см. тж. lib/log.mk); альтернативой было
бы пробрасывание переменных с полным путём ради единственного места

View File

@@ -1,10 +1,16 @@
### sample ~/.mkimage/profiles.mk
# sample ~/.mkimage/profiles.mk
### where to look for apt.conf; system one used by default
# where to look for apt.conf; system one used by default
#APTCONF = ~/apt/apt.conf.$(ARCH)
### turns on GLOBAL_VERBOSE and prettier output
# turns on GLOBAL_VERBOSE and prettier output
#DEBUG = 1
# spares tmpfs, quite recommended unless you need raw workdir chroots
#CLEAN = 1
# run with lower CPU and I/O priorities
#NICE = 1
# try and draw attention when done (depends on readline/terminal settings)
#BELL = 1

View File

@@ -6,30 +6,39 @@
- APTCONF
+ задаёт путь к требуемому apt.conf
+ значение: пусто (по умолчанию системный) либо строка
+ см. image.in/Makefile
+ см. ../image.in/Makefile, apt.conf.sample
- ARCH
+ определяет целевую архитектуру образа
+ задаёт целевую архитектуру образа
+ значение: пусто (по умолчанию авто), i586 или x86_64
+ см. iso.mk
+ см. ../lib/build.mk
- BELL
+ подаёт сигнал после завершения сборки
+ см. ../lib/build.mk
- BUILDDIR
+ определяет каталог генерируемого профиля и сборки
+ задаёт каталог генерируемого профиля и сборки
+ значение: пусто (по умолчанию авто) либо строка
+ см. profile.mk
+ см. ../lib/profile.mk
- CLEAN
+ экономия RAM при сборке в tmpfs, иначе места на диске
+ экономия RAM+swap при сборке в tmpfs, иначе места на диске
+ очистка рабочего каталога после успешной сборки очередной стадии
+ может помешать использовать некоторые варианты отладки
+ значение: любая строка, по умолчанию пусто
+ см. clean.mk
+ см. ../lib/clean.mk
- DEBUG
+ включение средств отладки
+ включает средства отладки
+ значение: пусто (по умолчанию), 1 или 2
+ см. log.mk
+ см. ../lib/log.mk
- NICE
+ понижает нагрузку системы сборочной задачей
+ значение: пусто (по умолчанию) либо любая строка
+ см. ../lib/build.mk
пример
~~~~~~
make DEBUG=1 CLEAN=1 syslinux.iso
make DEBUG=1 CLEAN=1 distro/syslinux.iso

View File

@@ -2,38 +2,34 @@
и должен дать представление о том, какой код _может_ быть
включён в настоящую фичу: статические файлы, два makefile
для создания конфигурации и генерирования части профиля,
а также шелл-скрипт для генерирования.
а также шелл-скрипт для такого генерирования.
Вовсе не требуется втягивать всё в свою фичу, лучше постараться
Вовсе не требуется втягивать всё в свою фичу: лучше постараться
сделать её минимальной, самодостаточной и полезной в качестве
"кирпичика".
Единственной необходимой частью фичи является файл config.mk,
Единственной обязательной частью фичи является файл config.mk,
который включается в distro.mk верхнего уровня и предоставляет
цель вида use/*, специфичную для данной фичи (а также добавляет
её в переменную FEATURES -- к сожалению, реализовать добавление
автоматом не представляется возможным). Если название фичи не
упоминается в списке, содержащемся в этой переменной, то она
не задействуется при построении профиля, а только при сборке
конфигурации дистрибутива.
цель вида use/*, специфичную для данной фичи, а также добавляет
её в переменную FEATURES. Если название фичи не упоминается
в списке, содержащемся в этой переменной, то она не задействуется
при построении профиля, а только при сборке конфигурации.
Остальное содержимое является дополнительным и используется
в таком порядке (см. features.in/Makefile):
в таком порядке (см. ../Makefile):
- сперва в $(BUILDDIR)/image/ копируются все подкаталоги,
соответствующие именам субпрофилей, запрошенных для
дистрибутивного профиля; при этом они сливаются с деревом,
соответствующие итоговым именам субпрофилей, запрошенных
для профиля образа; при этом они сливаются с деревом,
которое уже сформировано субпрофилями (../sub.in/*) и уже
скопированными фичами; если какие-либо файлы перекрылись
по именам, rsync должен оставить резервные копии (*~),
которые должны просигнализировать о беспорядке;
- затем запускается generate.sh, если существует и исполнимый;
- затем используется generate.mk, если существует и непустой.
- запускается generate.sh, если существует и исполнимый;
- применяется generate.mk, если существует и непустой.
Например, если используются субпрофили stage1, stage2/install2
и main, вы можете решить собрать специфические для фичи скрипты
и main, можно решить собрать специфические для фичи скрипты
инсталятора в install2/image-scripts.d/ (или необходимые для
операций с пакетной базой -- в main/scripts.d/, смотря чего
надо добиться; загляните также в документацию mkimage).
@@ -44,4 +40,4 @@
произвести из generate.sh и generate.mk.
Пожалуйста, присылайте отзывы о (бес)полезности кода в этом каталоге
mike@altlinux.
mike@altlinux.org.

View File

@@ -1,43 +0,0 @@
This directory contains phony example feature and should provide
you with a minimal idea what code _can_ be included into a real
feature: static files, configuration and generation makefiles,
and a generation shell script.
It's not neccessary to toss all of those into your feature,
better try to keep it minimalistic, self-contained and useful
as a building block.
The only requisite part of the feature is config.mk which
is included in toplevel distro.mk and which provides the
use/* target specific for the feature (and also registers
it in FEATURES variable -- sorry, it's not feasible to do
automatically). If the feature's name isn't mentioned in
the list contained in that variable, then it's not examined
while building up the profile either.
The rest of content is optional and used in this order
(see features.in/Makefile):
- first all subdirectories corresponding to subprofile names
requested for the distribution profile being made are copied
over to $(BUILDDIR)/image/; thus they get merged with the tree
which is already formed by subprofiles (../sub.in/*) and preceding
features; in case of overlapping files rsync should leave backup
copies which are to be treated as a signal of disorder;
- then generate.sh is run, if found and executable;
- then generate.mk is used, if found and non-empty.
e.g., if the distro needs stage1, install2 and main subprofiles,
you might want to collect feature-specific scripts for installer
into install2/image-scripts.d/ (or main/scripts.d/, depending on
what is to be achieved -- see also mkimage docs).
And if some non-trivial configuration actions are to be done
(like syslinux config file being compiled from pieces depending
on what bits are present of the functionality asked for...) then
you can perform them in generate.* code.
Please feel free to comment on what's useful here and what's crap
to mike@altlinux.

View File

@@ -2,8 +2,16 @@
# (only regarding the needed subprofiles)
ifndef BUILDDIR
$(error BUILDDIR not defined)
endif
help all:
@echo "** BUILDDIR not defined; available features:"
@for dir in */; do \
echo -n "$$dir: "; \
grep -h '^use/' $$dir/config.mk \
| cut -f1 -d: \
| tr '\n' ' ' \
| sort -u; \
done
else
include $(BUILDDIR)/distcfg.mk
@@ -19,6 +27,7 @@ include $(BUILDDIR)/distcfg.mk
### {image-,}scripts.d/ get rsynced twice :-/
### still we don't want the trimmed-down case
### sorry for somewhat complicated and overly long lines
all:
@echo "** starting feature configuration"
@if [ -n "$(GLOBAL_DEBUG)" ]; then \
@@ -26,51 +35,64 @@ all:
echo "** requested features: $(FEATURES)"; \
fi
@for feat in $(FEATURES); do \
pushd "$$feat" && \
if [ -n "$(GLOBAL_DEBUG)" ]; then \
echo "** adding $$feat feature"; \
fi; \
pushd "$$feat" >/dev/null && \
for sub in / $(SUBPROFILES); do \
src="$${sub%/*}"; \
dst="$${sub#*/}"; \
if [ -d "$$src" ]; then rsync -qab "$$src/" "$(BUILDDIR)/$$dst/"; fi; \
if [ -d "$$dst" ]; then rsync -qab "$$dst/" "$(BUILDDIR)/$$dst/"; fi; \
for scr in {image-,}scripts.d; do \
scriptdir="$(BUILDDIR)/$$dst/$$scr/"; \
if [ -d "$$scriptdir" ]; then \
if [ -d "$$scr" ]; then \
rsync -qab "$$scr/" "$$scriptdir/"; \
if [ -d "$$src" ]; then \
rsync -qab "$$src/" "$(BUILDDIR)/$$dst/"; \
dirtags="&& $$src"; \
fi; \
if [ -d "$$dst" ]; then \
rsync -qab "$$dst/" "$(BUILDDIR)/$$dst/"; \
if [ "$$dst" != "$$src" ]; then \
dirtags="&& ($$src || $$dst)"; \
fi; \
fi; \
for dir in lib {image-,}scripts.d; do \
destdir="$(BUILDDIR)/$$dst/$$dir/"; \
if [ -d "$$destdir" ]; then \
if [ -d "$$dir" ]; then \
rsync -qab "$$dir/" "$$destdir/"; \
fi; \
if [ -d "tagged/$$scr" ]; then \
pushd "tagged/$$scr" && \
echo "$$feat && ($$src || $$dst)" \
| tags2lists . \
| xargs -r cp -v -pLt "$$scriptdir" --; \
popd; \
if [ -d "tagged/$$dir" ]; then \
if pushd "tagged/$$dir" >/dev/null; then \
echo "$$feat $$dirtags" \
| tags2lists . \
| xargs -r cp -vpLt "$$destdir" --; \
popd >/dev/null; \
fi; \
fi; \
fi; \
done; \
type -t git >&/dev/null && \
pushd "$(BUILDDIR)/$$dst/" && \
git add . && \
if [ -n "$$dst" ]; then \
the="$$sub subprofile"; \
else \
the="toplevel"; \
if type -t git >&/dev/null && \
pushd "$(BUILDDIR)/$$dst/" >/dev/null; then \
test -n "`git status -s`" && \
git add . && \
if [ -n "$$dst" ]; then \
the="$$sub subprofile"; \
else \
the="toplevel"; \
fi && \
git commit -qam "$$feat feature: $$the part added"; \
popd >/dev/null; \
fi; \
git commit -qam "$$feat feature ($$the part)" ||:; \
popd; \
done; \
if [ -x "generate.sh" ]; then sh generate.sh; fi; \
if [ -s "generate.mk" ]; then $(MAKE) -f generate.mk; fi; \
type -t git >&/dev/null && \
pushd "$(BUILDDIR)/" && \
git add . && \
git commit -qam "$$feat feature generation complete" ||:; \
popd; \
popd; \
if type -t git >&/dev/null && \
pushd "$(BUILDDIR)/" >/dev/null; then \
if test -n "`git status -s`"; then \
git add . && \
git commit -qam "$$feat feature generation complete"; \
fi; \
popd >/dev/null; \
fi; \
popd >/dev/null; \
done
@find "$(BUILDDIR)/" -name '*~' \
| sed "s,$(BUILDDIR)/,** warning: file clash: ," >&2
# FIXME: drop or fix regarding undefined BUILDDIR being ok
#help:
# @echo "** available features:"
# @grep -h '^use/' */config.mk | fmt -sw"$$((COLUMNS>>1))" | column -t
endif

View File

@@ -1,15 +1,15 @@
Этот каталог содержит т.н. фичи (features, особенности) --
каталоги, содержимое каждого из которых реализует одну из
подключаемых автономных возможностей дистрибутива.
подключаемых автономных возможностей образа.
Каждая фича должна содержать задействуемый при построении
конфигурации будущего образа файл config.mk, включаемый
в ../distro.mk; он может описывать одну или более целей
вида use/*, дополняющих конфигурацию дистрибутива, и при
наличии дополнительных хуков для копирования или generate.*
в ../Makefile; он может описывать одну или более целей
вида use/*, дополняющих конфигурацию, и при наличии
дополнительных хуков для копирования или generate.*
должен добавить имя фичи в $(FEATURES).
На этапе генерации дистрибутивного профиля фичи рассматриваются
На этапе генерации сборочного профиля фичи рассматриваются
после инициализации профиля (см. ../image.in/) и копирования
субпрофилей (см. ../sub.in/). Для каждой фичи, указанной
в $(FEATURES), копируются подкаталоги сообразно субпрофилям,
@@ -24,5 +24,14 @@ generate.sh и задействуется generate.mk (при их наличи
построенных на одном базовом, можно воспользоваться подкаталогом
с именем исходного базового субпрофиля (см. $src, $dst в Makefile).
Каталог lib/ является специфическим для фич, определяющих
построение конкретного вида образа -- см. build-*/.
Несложный пример содержится в 00example/, более близкий к жизни
и нынешним пределам возможностей метапрофиля -- в syslinux/.
Основные фичи для построения дистрибутивных образов:
- stage1: propagator, ядро инсталятора и initrd в т.ч. с firmware
- stage2: базовый live-образ (и модули ядра, соответствующие stage1);
используется фичами install2, live, rescue
- main: пакетная база

View File

@@ -6,4 +6,5 @@
и требует пакет выбранного загрузчика.
Реализация экспериментальная (нужно модуляризовать installer-steps),
пока завязана на installer-distro-altlinux-generic.
пока завязана на installer-distro-altlinux-generic (TODO). Возможно,
с использованием alterator-lilo связаны проблемы времени установки.

View File

@@ -0,0 +1,4 @@
Эта фича конфигурирует создание образа дистрибутива, включая работу
с субпрофилями -- которая сейчас нужна только дистрибутивным целям.
Дополняет финальную стадию сборки (lib/, scripts.d/).

View File

@@ -0,0 +1,2 @@
use/build-distro: boot/isolinux
@$(call add,FEATURES,build-distro)

View File

@@ -0,0 +1,46 @@
# step 4: build the distribution image
# for complex-specified subprofiles like stage2/live,
# take the latter part
SUBDIRS = $(notdir $(SUBPROFILES))
# "main" subprofile needs genbasedir
CHROOT_PACKAGES = apt-utils
BOOT_TYPE = isolinux
# Metadata/ needed only for installers (and not for e.g. syslinux.iso)
# FIXME: installable live needs it too, don't move to install2 feature
ifneq (,$(findstring install2,$(FEATURES)))
METADATA = metadata
endif
all: $(GLOBAL_DEBUG) prep copy-subdirs copy-tree run-scripts pack-image \
postprocess $(GLOBAL_CLEAN_WORKDIR)
prep: $(GLOBAL_DEBUG) dot-disk $(METADATA) $(IMAGEDIR)
metadata: dot-base
@mkdir -p files/Metadata
@rm -f files/Metadata/pkg-groups.tar
# see also alterator-pkg (backend3/pkg-install); we only tar up what's up to it
@tar -cvf files/Metadata/pkg-groups.tar -C $(PKGDIR) \
$$(echo $(call list,$(MAIN_GROUPS) .base) \
$(call group,$(MAIN_GROUPS)) \
| sed 's,$(PKGDIR)/*,,g')
dot-base:
@{ \
echo -e "\n## added by image.in/Makefile"; \
echo "$(call kpackages,$(KMODULES),$(KFLAVOURS))"; \
} >> $(call list,.base)
dot-disk:
@mkdir -p files/.disk
@echo "ALT Linux based" >files/.disk/info
@echo "$(ARCH)" >files/.disk/arch
@echo "$(DATE)" >files/.disk/date
@if type -t git >&/dev/null; then \
( cd $(TOPDIR) && test -d .git && \
git show-ref --head -ds -- HEAD ||:) \
>files/.disk/commit 2>/dev/null; \
fi

View File

@@ -17,12 +17,15 @@ comps="$(find -mindepth 1 -maxdepth 1 -type d -name 'RPMS.*' -printf '%f\n' |
verbose "comps=$comps"
[ -n "$comps" ] || exit 1
genbasedir \
--topdir="$WORKDIR" \
--architecture="$INFO_ARCH" \
--no-oldhashfile \
--partial \
--bz2only \
--xz \
--bz2 \
--create \
--notautomatic=false \
${INFO_NAME:+--archive="$INFO_NAME"} \
@@ -31,4 +34,7 @@ genbasedir \
${INFO_LABEL:+--label="$INFO_LABEL"} \
ALTLinux $comps
### drop this when genbasedir is fixed (--no-uncompressed)
for comp in $comps; do rm -f base/{pkg,src}list.$comp; done
verbose finished

View File

@@ -0,0 +1,3 @@
Эта фича конфигурирует создание образа виртуального окружения (VE).
Дополняет финальную стадию сборки (lib/, image-scripts.d/).

View File

@@ -0,0 +1,2 @@
use/build-ve:
@$(call add,FEATURES,build-ve)

View File

@@ -0,0 +1,11 @@
#!/bin/sh
# VEs typically have no means to communicate with the outer
# world except for networking; still this might need some
# more tweaking for networkless LXC case
# candidates:
# off: keytable
for i in network random syslogd random; do chkconfig $i on; done
for i in fbsetfont netfs rawdevices; do chkconfig $i off; done
:

View File

@@ -0,0 +1,3 @@
#!/bin/sh -e
# we don't need no gettys in OpenVZ VEs (might need one in LXC though)
subst 's,^[0-9]\+:[0-9]\+:respawn:/sbin/mingetty.*,#&,' /etc/inittab

View File

@@ -0,0 +1,3 @@
#!/bin/sh -e
# should be pretty much obsolete but just in case
[ -L /etc/mtab ] || ln -sf /proc/mounts /etc/mtab

View File

@@ -0,0 +1,13 @@
#!/bin/sh -e
# tweak syslog configuration to:
# - avoid logging to a nonexistent tty;
# - avoid hard sync logging (one is better off doing
# remote syslog if you do care for reliable data anyways)
# credits: vvk@, thresh@ (2010)
sed -i \
-e 's,/dev/tty12,/var/log/syslog/console,' \
-e 's,^.*/var/log/syslog/console$,#&,' \
-e 's,-/var/log/,/var/log/,g' \
-e 's,/var/log/,-/var/log/,g' \
/etc/syslog.conf

View File

@@ -0,0 +1,11 @@
# step 4: build the virtual environment image
MKI_TAR_COMPRESS = $(IMAGE_COMPRESS)
IMAGE_PACKAGES = $(call list,$(BASE_LISTS)) \
$(SYSTEM_PACKAGES) \
$(COMMON_PACKAGES) \
$(BASE_PACKAGES)
all: $(GLOBAL_DEBUG) build-image copy-tree run-image-scripts pack-image \
postprocess $(GLOBAL_CLEAN_WORKDIR)

View File

@@ -1,4 +1,5 @@
#!/bin/sh -efu
# create a postinstall script to drop temporarily needed packages
if [ -n "$GLOBAL_VERBOSE" ]; then
echo "** GLOBAL_CLEANUP_PACKAGES: $GLOBAL_CLEANUP_PACKAGES"

5
features.in/dev/README Normal file
View File

@@ -0,0 +1,5 @@
Эта фича служит для создания образов, предназначающихся для разработки.
В первую очередь обеспечивается развёртывание hasher и mkimage.
Реализована поддержка LiveCD, возможно приспособление для образов
сборочных VM/VE.

View File

@@ -0,0 +1,7 @@
use/dev:
@$(call add,FEATURES,dev)
@$(call add,COMMON_PACKAGES,git-core hasher gear)
use/dev/mkimage: use/dev
@$(call add,COMMON_PACKAGES,mkimage)
@$(call add,LIVE_PACKAGES,shadow-change)

View File

@@ -0,0 +1,44 @@
#!/bin/sh -efu
# configure hasher (implies that 30-users has been run already)
# predefined passwordless livecd user
USER="altlinux"
if ! id "$USER" >&/dev/null; then
echo "No such user '$USER'" >&2
exit
fi
# ~
HOME="/home/$USER"
install -dm750 -o "$USER" -g "$USER" "$HOME"
# we honestly don't know much more
if type -t git >&/dev/null; then
su - -c "git config --global user.email $USER@localhost" "$USER"
su - -c "git config --global user.name 'live builder'" "$USER"
fi
# developer should feel comfortable, eh? ;-)
ZSHELL="/bin/zsh"
if [ -x "$ZSHELL" ]; then
chsh -s "$ZSHELL" "$USER"
install -m755 -o "$USER" -g "$USER" /dev/null "$HOME/.zshrc"
echo "mkdir -p \"\$TMP/hasher\"" >> "$HOME/.zshrc"
fi
# $TMP
TMP="/tmp/.private/$USER"
control pam_mktemp enabled
subst '/^%_tmppath.*tmp$/d' "$HOME/.rpmmacros"
echo "%_tmppath $TMP" >> "$HOME/.rpmmacros"
# ~/hasher
WORKDIR="$TMP/hasher"
ln -s "$TMP/hasher" "$HOME/hasher"
# online repo needs network not isolation
echo "export share_network=1" >> /etc/profile.d/hasher.sh
chmod +x /etc/profile.d/hasher.sh
# requisite
hasher-useradd "$USER"

View File

@@ -0,0 +1,7 @@
#!/bin/sh -efu
# attempt to autoconfigure ethernet
mkdir -p /etc/net/ifaces/eth0 && {
echo TYPE=eth
echo BOOTPROTO=dhcp
} > /etc/net/ifaces/eth0/options ||:

View File

@@ -0,0 +1,9 @@
#!/bin/sh -efu
# configure local image repository provided by sub/main
# TODO: some integration with sub/main to ensure that it is there
{
echo "# for real stuff you'll need full repo, see apt-repo"
echo "rpm file:/image ALTLinux main"
} > /etc/apt/sources.list.d/cdrom.list

View File

@@ -4,3 +4,6 @@
Для практического применения (в первую очередь это
перешивка firmware) требуется сделать подключение
CD и/или USB Flash с тем, чтобы класть туда прошивки.
Спасибо за идею и местами реализацию: Александру Бандуре,
Сергею Горенко, Николаю Гречуху и Алексею Фролову.

View File

@@ -9,12 +9,10 @@ use/firmware/server: use/firmware
@$(call add,SYSTEM_PACKAGES,firmware-aic94xx-seq)
@$(call add,MAIN_PACKAGES_REGEXP,firmware-ql.*)
use/firmware/desktop: use/firmware
@$(call add,SYSTEM_PACKAGES,firmware-psb)
use/firmware/wireless: use/firmware
@$(call add,MAIN_PACKAGES,firmware-acx100)
@$(call add,MAIN_PACKAGES,firmware-i2400m)
@$(call add,MAIN_PACKAGES,firmware-carl9170)
@$(call add,MAIN_PACKAGES_REGEXP,firmware-ipw.*)
@$(call add,MAIN_PACKAGES_REGEXP,firmware-iwl.*)
@$(call add,MAIN_PACKAGES_REGEXP,firmware-rt.*)

View File

@@ -1,4 +1,4 @@
Добавление модуля hdt (Hardware Detection Tool COM32 module) к syslinux;
Добавление модуля hdt (Hardware Detection Tool) к syslinux;
может быть востребовано для инсталяторов, live/rescue.
Фича не только требует фичу syslinux (и соответствующий пакет,

View File

@@ -2,5 +2,3 @@ use/hdt: use/syslinux use/memtest
@$(call add,FEATURES,hdt)
@$(call add,STAGE1_PACKAGES,pciids)
@$(call add,SYSLINUX_MODULES,hdt)
### moved to scripts.d/02-hdt along with compression
# @$(call add,SYSLINUX_FILES,/usr/share/misc/pci.ids)

View File

@@ -1,7 +1,4 @@
#!/bin/sh
# stage1 needs this
mkdir -p /image
# setup stage2 as init
mv -f /usr/sbin/install2-init /sbin/init

View File

@@ -11,7 +11,7 @@ HSH_EXCLUDE_DOCS = 1
# pass downstream
GLOBAL_BASE_BOOTLOADER := $(BASE_BOOTLOADER)
debug:
debug::
@echo "** install2: IMAGE_PACKAGES: $(IMAGE_PACKAGES)"
@echo "** install2: IMAGE_PACKAGES_REGEXP: $(IMAGE_PACKAGES_REGEXP)"
@echo "** install2: CLEANUP_PACKAGES: $(CLEANUP_PACKAGES)"

View File

@@ -0,0 +1,32 @@
#!/bin/sh
# purge anything unused during installation
rm -rf /usr/share/icons/{hicolor,large,mini}
# PAM plugins
rm -rf /lib*/security
rm -rf /usr/share/ca-certificates
rm -rf /usr/lib/qt4/plugins/codecs
rm -rf /usr/lib/qt4/plugins/bearer
rm -rf /usr/lib/qt4/plugins/inputmethods
rm -rf /usr/share/qt4/{doc,mkspecs,phrasebooks}
rm -rf /usr/share/guile/*/{*.txt,scripts}
rm -rf /usr/share/awk/
### could it be handled with any grace?
### TODO: x11vnc, xorg-xvfb: fix installer-common-stage2
rpmquery -a cpp\* gcc\* perl-base file ipv6calc \
bind-utils libbind \
gnupg libgcrypt libgnutls\* libgpg-error libsoup\* \
libGL glxinfo xdriinfo \
make make-initrd x11vnc xorg-xvfb \
| xargs -r rpmi -e --nodeps --
rpmquery -a bind-utils libbind \
| xargs -r rpmi -e --
# outstanding binaries
rm -f /sbin/{sln,tc}
rm -f /usr/bin/openssl

View File

@@ -0,0 +1,5 @@
#!/bin/sh
# remove all docs
rpmquery -ad |grep ^/ |xargs -r rm -f --
rm -rf /usr/share/{doc,man,info,license,gfxboot}

View File

@@ -1,64 +1,50 @@
#!/bin/sh
# remove all docs
rpmquery -adl |grep ^/ |xargs -r rm -f --
rm -rf /usr/share/{doc,man,info,license,gfxboot}
# remove unused icons
rm -rf /usr/share/icons/{hicolor,large,mini}
# remove PAM plugins
rm -rf /lib*/security
# remove some unused files
rm -rf /usr/share/ca-certificates
rm -rf /usr/lib/qt4/plugins/codecs
rm -f /usr/lib*/gconv/IBM*
rm -f /usr/lib*/gconv/BIG5*
rm -f /usr/lib*/gconv/EBCDIC*
# remove unneeded timezones
rm -rf /usr/share/zoneinfo/{posix,right}/
# remove unneeded l10n
find /usr/share/locale/ -type f \! -name 'alterator*' -delete
# remove non-utf8 locales
find /usr/lib*/locale -mindepth 1 -maxdepth 1 -type d \! -name '*.utf8' -print0 |
xargs -r0 rm -rf --
# drop extra drivers et al, purge kernel image(s)
# xorg modules
rm -r /usr/lib*/X11/modules/dri
# remove ogfs
rm -f /lib*/evms/*/ogfs*
# evms modules; see http://evms.sourceforge.net/user_guide/
rm -f /lib*/evms/*/{bbr,csm,drivelink,ogfs,replace,snapshot}*
# remove cpp, gcc and perl
rpmquery -a cpp\* gcc\* perl-base |
xargs -r rpmi -e --nodeps --
# remove unneeded kernel modules
# unneeded kernel modules
### some of these removals belong to a purge grade script
### TODO: mostly scsi-less and net-less cleanup for antique
rm -rf /lib/modules/*/kernel/arch
rm -rf /lib/modules/*/kernel/drivers/atm
rm -rf /lib/modules/*/kernel/drivers/char/ipmi
rm -rf /lib/modules/*/kernel/drivers/bluetooth
rm -rf /lib/modules/*/kernel/drivers/char/{ipmi,hw_random,mwave,tpm}
rm -rf /lib/modules/*/kernel/drivers/char/watchdog
rm -rf /lib/modules/*/kernel/drivers/cpufreq
rm -rf /lib/modules/*/kernel/drivers/edac
rm -rf /lib/modules/*/kernel/drivers/firmware ###
rm -rf /lib/modules/*/kernel/drivers/gpio
rm -rf /lib/modules/*/kernel/drivers/hwmon
rm -rf /lib/modules/*/kernel/drivers/infiniband ###
rm -rf /lib/modules/*/kernel/drivers/input/{gameport,joy*}
rm -rf /lib/modules/*/kernel/drivers/isdn
rm -rf /lib/modules/*/kernel/drivers/leds
rm -rf /lib/modules/*/kernel/drivers/media
rm -rf /lib/modules/*/kernel/drivers/mmc
rm -rf /lib/modules/*/kernel/drivers/mtd*
rm -rf /lib/modules/*/kernel/drivers/net/can
rm -rf /lib/modules/*/kernel/drivers/net/hamradio
rm -rf /lib/modules/*/kernel/drivers/net/irda
rm -rf /lib/modules/*/kernel/drivers/net/tokenring
rm -rf /lib/modules/*/kernel/drivers/net/wimax
rm -rf /lib/modules/*/kernel/drivers/net/wireless
rm -rf /lib/modules/*/kernel/drivers/net/wan
rm -rf /lib/modules/*/kernel/drivers/regulator
rm -rf /lib/modules/*/kernel/drivers/staging
rm -rf /lib/modules/*/kernel/drivers/spi
rm -rf /lib/modules/*/kernel/drivers/target
rm -rf /lib/modules/*/kernel/drivers/telephony
rm -rf /lib/modules/*/kernel/drivers/usb/{misc,mon}
rm -rf /lib/modules/*/kernel/drivers/tty/[^s][^e]*
rm -rf /lib/modules/*/kernel/drivers/usb/{atm,c67*,image,misc,mon,otg,serial,wusbcore}
rm -rf /lib/modules/*/kernel/drivers/usb/storage/ums*
rm -rf /lib/modules/*/kernel/drivers/uwb
rm -rf /lib/modules/*/kernel/drivers/w1
rm -rf /lib/modules/*/kernel/drivers/watchdog
rm -rf /lib/modules/*/kernel/fs/9p
rm -rf /lib/modules/*/kernel/fs/adfs
rm -rf /lib/modules/*/kernel/fs/affs
@@ -68,12 +54,16 @@ rm -rf /lib/modules/*/kernel/fs/autofs4
rm -rf /lib/modules/*/kernel/fs/befs
rm -rf /lib/modules/*/kernel/fs/bfs
rm -rf /lib/modules/*/kernel/fs/btrfs
rm -rf /lib/modules/*/kernel/fs/ceph
rm -rf /lib/modules/*/kernel/fs/cifs
rm -rf /lib/modules/*/kernel/fs/coda
rm -rf /lib/modules/*/kernel/fs/configfs
rm -rf /lib/modules/*/kernel/fs/cramfs
rm -rf /lib/modules/*/kernel/fs/dlm
rm -rf /lib/modules/*/kernel/fs/efs
rm -rf /lib/modules/*/kernel/fs/exofs
rm -rf /lib/modules/*/kernel/fs/freevxfs
rm -rf /lib/modules/*/kernel/fs/fscache
rm -rf /lib/modules/*/kernel/fs/fuse
rm -rf /lib/modules/*/kernel/fs/hfs
rm -rf /lib/modules/*/kernel/fs/hfsplus
@@ -81,18 +71,26 @@ rm -rf /lib/modules/*/kernel/fs/hpfs
rm -rf /lib/modules/*/kernel/fs/jffs
rm -rf /lib/modules/*/kernel/fs/jffs2
rm -rf /lib/modules/*/kernel/fs/lockd
rm -rf /lib/modules/*/kernel/fs/logfs
rm -rf /lib/modules/*/kernel/fs/minix
rm -rf /lib/modules/*/kernel/fs/ncpfs
rm -rf /lib/modules/*/kernel/fs/nilfs2
rm -rf /lib/modules/*/kernel/fs/ocfs2
rm -rf /lib/modules/*/kernel/fs/omfs
rm -rf /lib/modules/*/kernel/fs/qnx4
rm -rf /lib/modules/*/kernel/fs/romfs
rm -rf /lib/modules/*/kernel/fs/smbfs
rm -rf /lib/modules/*/kernel/fs/sysv
rm -rf /lib/modules/*/kernel/fs/ubifs
rm -rf /lib/modules/*/kernel/fs/udf
rm -rf /lib/modules/*/kernel/fs/ufs
rm -rf /lib/modules/*/kernel/net/*/netfilter
rm -rf /lib/modules/*/kernel/net/9p
rm -rf /lib/modules/*/kernel/net/appletalk
rm -rf /lib/modules/*/kernel/net/atm
rm -rf /lib/modules/*/kernel/net/ax25
rm -rf /lib/modules/*/kernel/net/can
rm -rf /lib/modules/*/kernel/net/ceph
rm -rf /lib/modules/*/kernel/net/bluetooth
rm -rf /lib/modules/*/kernel/net/dccp
rm -rf /lib/modules/*/kernel/net/decnet
@@ -102,22 +100,24 @@ rm -rf /lib/modules/*/kernel/net/ipx
rm -rf /lib/modules/*/kernel/net/irda
rm -rf /lib/modules/*/kernel/net/netfilter
rm -rf /lib/modules/*/kernel/net/netrom
rm -rf /lib/modules/*/kernel/net/rds
rm -rf /lib/modules/*/kernel/net/rose
rm -rf /lib/modules/*/kernel/net/sctp
rm -rf /lib/modules/*/kernel/net/tipc
rm -rf /lib/modules/*/kernel/net/{wimax,wireless,mac80211}
rm -rf /lib/modules/*/kernel/net/x25
rm -rf /lib/modules/*/kernel/sound
# remove blacklisted kernel modules
# blacklisted kernel modules
sed -n 's/^blacklist[[:space:]]\+\([^[:space:]]\+\).*/\1/p' /etc/modprobe.d/* |
while read i; do
find /lib/modules/ -type f -name "$i.ko" -delete
done
# run depmod after kernel modules removal
# regenerate module dependencies
for i in /lib*/modules/*; do
/sbin/depmod -a -F /boot/System.map-${i##*/} ${i##*/}
/sbin/depmod -a -F /boot/System.map-${i##*/} ${i##*/}
done
# remove kernel images
# kernel images
rm -rf /boot/*

View File

@@ -0,0 +1,22 @@
#!/bin/sh
# drop unused l10n/i18n data
# the fell swoop
find /usr/share/locale/ -type f \! -name 'alterator*' -delete
rm -rf /usr/share/zoneinfo/{posix,right}/
# charset conversion tables
### NB: BIG5* and friends should be handled consistently
rm -f /usr/lib*/gconv/IBM*
rm -f /usr/lib*/gconv/BIG5*
rm -f /usr/lib*/gconv/EBCDIC*
# en_* variations
rm -rf /usr/{lib*,share}/locale/en_[^U]*
# non-utf8 locales
find /usr/lib*/locale -mindepth 1 -maxdepth 1 -type d \! -name '*.utf8' -print0 |
xargs -r0 rm -rf --
# dangling symlinks
find /usr/lib*/locale \! -readable -delete

View File

@@ -1,3 +1,9 @@
use/live: use/stage2 sub/stage2/live
@$(call add,FEATURES,live)
@$(call add,LIVE_LISTS,$(call tags,(base || desktop) && (live || network || icewm)))
use/live/base: use/live use/syslinux/ui-menu
@$(call add,LIVE_LISTS,$(call tags,base && (live || network)))
use/live/icewm: use/live/base
@$(call add,LIVE_LISTS,\
$(call tags,(base || desktop) && (live || network || icewm)))

View File

@@ -0,0 +1,12 @@
#!/bin/sh -efu
# if no means for locale setup are employed,
# it should still be somewhat reasonable
# NB: keyboard layout not included!
mkdir -p /etc/sysconfig
cat >> /etc/sysconfig/i18n << _EOF_
# mkimage-profiles live 20-locale hook
SYSFONT=UniCyr_8x16
LANG=en_US.utf8
_EOF_
:

View File

@@ -23,8 +23,7 @@ add_user()
fi
done
/usr/sbin/useradd -p "" -G "$groups" "$1" ||:
chown -R "$1:auth" "/etc/tcb/$1"
useradd -p "" -G "$groups" "$1" ||:
chown -R "$1:$1" /home/$1
if [ -n "$GLOBAL_CRYPT_HOMES" ]; then
@@ -39,13 +38,14 @@ add_user()
else
verbose "Can't find writable $sudoers file."
fi
echo "Hello friend, say \`$1' to log in at \\l" >> /etc/issue
}
verbose "has started"
verbose "Clear password for root account"
/usr/sbin/usermod -p "" root
chown -R root.auth /etc/tcb/root
usermod -p "" root
add_user altlinux

View File

@@ -7,8 +7,8 @@ cd /usr/share/fonts/bitmap/misc/ &&
# drop unneeded translation
# FIXME: whitelist is reasonable
cd /usr/share/qt4/translations/ &&
rm -f *_ar* *_cs* *_da* *_de* *_es* *_fr* \
*_gl* *_he* *_hu* *_pl* \
rm -f *_ar* *_cs* *_da* *_de* *_es* *_fa* *_fr* \
*_gl* *_he* *_hu* *_ko* *_pl* \
*_sk* *_sl* *_sv*
# ...l10n...
@@ -20,23 +20,19 @@ cd /usr/share/X11/locale &&
cd /usr/share/X11/xkb/symbols &&
ls \
| egrep -v 'by|en|kz|pt|ru|ua|us|pc|....*' \
| xargs rm -rf
| xargs rm -rf --
# gconv
cd /usr/lib*/gconv &&
rm -f EUC* G* I*
# locales
cd /usr/lib*/locale &&
for dir in /usr/{lib*,share}/locale; do
cd "$dir" && \
ls \
| egrep -v '^(be|en|kk|pt|ru|uk)_' \
| xargs rm -rf
# remove kbd data
# FIXME: might break things?
#rm -rf /lib/kbd/
# outstanding binaries
rm /bin/ipv6calc /sbin/sln
| egrep -v '^be|en|kk|pt|ru|uk' \
| xargs rm -rf --;
done
### consider cleaning up kbd data (partially?)
:

View File

@@ -1,2 +1,2 @@
Добавление memtest86+ в загрузку с образа и в устанавливаемую пакетную базу;
востребовано для для инсталяторов, live/rescue. Интегрируется с syslinux.
востребовано для инсталяторов, live/rescue. Интегрируется с syslinux.

3
features.in/pack/README Normal file
View File

@@ -0,0 +1,3 @@
Эта фича определяет формат упаковки создаваемого образа.
На данный момент поддерживаются iso (загрузочный ISO9660
для дистрибутивов) и tar/tgz (виртуальные окружения).

View File

@@ -0,0 +1,18 @@
DISTRO_EXTS := .iso
VE_EXTS := .tar .tgz
use/pack:
@$(call add,FEATURES,pack)
use/pack/iso: use/pack boot/isolinux
ifeq (distro,$(IMAGE_CLASS))
@$(call set,IMAGE_PACKTYPE,isoboot)
else
@$(call set,IMAGE_PACKTYPE,isodata)
endif
use/pack/tar: use/pack
@$(call set,IMAGE_PACKTYPE,tar)
use/pack/tgz: use/pack/tar
@$(call set,IMAGE_COMPRESS,gzip)

View File

@@ -1,2 +1,4 @@
Эта фича конфигурирует поддержку управления кнопкой питания
-- выключение для ACPI, засыпание для APM (не проверялось).
TODO: учесть изложенное в https://bugzilla.altlinux.org/25018

View File

@@ -1,8 +1,5 @@
#!/bin/sh
# stage1 needs this <-- FIXME: duplicated in sub.in/stage2/image-scripts.d/00propagator
#mkdir -p /image
# m-p-d::profiles/rescue/image-scripts.d/999system
mv -f -- /etc/inittab.rescue /etc/inittab

View File

@@ -7,6 +7,6 @@ IMAGE_PACKAGES = $(COMMON_PACKAGES) \
MKI_PACK_RESULTS = squash:rescue
debug:
debug::
@echo "** rescue: IMAGE_PACKAGES: $(IMAGE_PACKAGES)"
@echo "** rescue: IMAGE_PACKAGES_REGEXP: $(IMAGE_PACKAGES_REGEXP)"

View File

@@ -1,21 +1,23 @@
Добавление поддержки syslinux; требуется для инсталяторов, live/rescue.
Добавление поддержки syslinux; требуется для инсталяторов, live/rescue;
реализуется в рамках stage1.
Цели config.mk:
* use/syslinux/ui-% -- конфигурирование интерфейса (см. cfg.in/00*.cfg);
при использовании автоматически добавляют syslinux в FEATURES
при использовании автоматически добавляют syslinux в FEATURES;
* use/syslinux/%.com, use/syslinux/%.c32 -- подключение одноименных модулей
(копирование бинарников и включение кусочков конфигурации; экспериментальное)
* use/syslinux/%.cfg -- подключение кусочков конфигурации (используется)
(копирование бинарников и включение кусочков конфигурации; экспериментальное);
* use/syslinux/%.cfg -- подключение кусочков конфигурации.
Переменные generate.mk:
* BOOTLOADER -- isolinux (TODO: добавить поддержку syslinux для флэшек);
* BOOTLOADER -- isolinux (реализовано с оглядкой на syslinux/syslinux4);
* SYSLINUX_UI -- модуль интерфейса (если не указан, то внутренний prompt);
* SYSLINUX_MODULES -- модули .com или .c32 (перечисляются без расширения);
* SYSLINUX_CFG -- дополнительные кусочки конфигурации (например, localboot).
Здесь производится первичная обработка конфигурационных данных,
окончательно проверяемых и используемых уже в инструментальном чруте.
TODO: может потребоваться обобщение механизма генерации с учётом
многоуровневых меню и включаемых файлов (которыми лучше не злоупотреблять
из соображений скорости инициализации загрузчика); требуется обеспечить
брендирование заголовков.

View File

@@ -1,3 +1,3 @@
ui gfxboot bootlogo
menu title mkimage-profiles 2.0
ui gfxboot bootlogo message
menu title ALT Linux (@mkimage-profiles@)
prompt 0

View File

@@ -1,3 +1,3 @@
ui menu.c32
menu title mkimage-profiles 2.0
menu title ALT Linux (@mkimage-profiles@)
prompt 0

View File

@@ -1,2 +1,2 @@
say mkimage-profiles 2.0
say ALT Linux (@mkimage-profiles@)
prompt 1

View File

@@ -1,3 +1,3 @@
ui vesamenu
menu title mkimage-profiles 2.0
menu title ALT Linux (@mkimage-profiles@)
prompt 0

View File

@@ -0,0 +1,3 @@
label removable
menu label Boot from ^removable drive
localboot 0x00

View File

@@ -1,5 +1,5 @@
# default is plain text prompt
use/syslinux:
use/syslinux: sub/stage1
@$(call add,FEATURES,syslinux)
@$(call add,STAGE1_PACKAGES,syslinux)

View File

@@ -45,10 +45,11 @@ cfg = $(wildcard cfg.in/??$(1).cfg)
#
# arguments get evaluated before recipe body execution thus prep
all: prep debug
@echo $(sort \
@cp -pLt $(DSTDIR) -- $(sort \
$(foreach C,$(SYSLINUX_CFG),$(call cfg,$(C))) \
$(foreach M,$(SYSLINUX_MODULES),$(call cfg,$(M)))) \
| xargs cp -pLt $(DSTDIR) --
$(foreach M,$(SYSLINUX_MODULES),$(call cfg,$(M))))
@### proper text branding should be implemented
@sed -i 's,@mkimage-profiles@,$(IMAGE_NAME),' $(DSTDIR)/*.cfg
@echo $(SYSLINUX_MODULES) > $(DSTDIR)/modules.list
@echo $(SYSLINUX_FILES) > $(DSTDIR)/files.list
@echo $(BOOTLOADER) > $(DSTDIR)/bootloader

View File

@@ -1,82 +1,49 @@
# step 4: build image (final stage)
#
# NB: this directory forms the initial BUILDDIR/
# stage 4: dive into mkimage
ifndef GLOBAL_BUILDDIR
$(error GLOBAL_BUILDDIR not defined)
endif
GLOBAL_BUILDDIR ?= $(shell pwd)
CURRENT_LINK := mkimage-profiles
OUT_LINK := out
include distcfg.mk
include functions.mk
include $(GLOBAL_BUILDDIR)/functions.mk
include $(GLOBAL_BUILDDIR)/distcfg.mk
include $(MKIMAGE_PREFIX)/config.mk
# for complex-specified subprofiles like stage2/live,
# take the latter part
SUBDIRS = $(notdir $(SUBPROFILES))
# reconstruct instead of passing yet another variable
IMAGE_LINK := $(IMAGE_NAME).$(IMAGE_TYPE)
IMAGE_OUTFILE := $(IMAGE_NAME)-$(DATE)-$(ARCH).$(IMAGE_TYPE)
MKI_PACK_RESULTS = $(IMAGE_PACKTYPE):$(IMAGE_OUTFILE)
# "main" subprofile needs genbasedir
CHROOT_PACKAGES = apt-utils
###
MKI_PACK_RESULTS = isoboot:$(IMAGENAME)
# these get opied over as is
COPY_TREE = ./files
BOOT_TYPE = isolinux
# outdir shouldn't be wiped clean before use
CLEANUP_OUTDIR ?=
APTCONF := $(wildcard $(APTCONF))
ifeq "$(APTCONF)" ""
GLOBAL_HSH_APT_CONFIG = /etc/apt/apt.conf
else
GLOBAL_HSH_APT_CONFIG = $(APTCONF)
endif
# Metadata/ needed only for installers (and not for e.g. syslinux.iso)
ifneq "$(STAGE1_KFLAVOUR)$(KFLAVOURS)" ""
METADATA = metadata
endif
GLOBAL_HSH_APT_CONFIG := $(wildcard $(APTCONF))
# the lib/build-*.mk comes from features.in/build-*/lib
include lib/*.mk
include $(MKIMAGE_PREFIX)/targets.mk
all: $(GLOBAL_DEBUG) prep copy-subdirs copy-tree run-scripts pack-image \
$(GLOBAL_CLEAN_WORKDIR)
prep: $(GLOBAL_DEBUG) dot-disk $(METADATA) $(IMAGEDIR)
metadata: dot-base
@mkdir -p files/Metadata
@rm -f files/Metadata/pkg-groups.tar
# see also alterator-pkg (backend3/pkg-install); we only tar up what's up to it
@tar -cvf files/Metadata/pkg-groups.tar -C $(PKGDIR) \
$$(echo $(call list,$(MAIN_GROUPS) .base) \
$(call group,$(MAIN_GROUPS)) \
| sed 's,$(PKGDIR)/*,,g')
dot-base:
@{ \
echo -e "\n## added by image.in/Makefile"; \
echo "$(call kpackages,$(KMODULES),$(KFLAVOURS))"; \
} >> $(call list,.base)
# specified only for the final image (target-specific)
pack-image: OUTDIR = $(IMAGEDIR)
pack-image: $(IMAGEDIR)
$(IMAGEDIR):
@mkdir -p "$(IMAGEDIR)"
# specified only for the final image, not for the subparts
pack-image: OUTDIR = $(IMAGEDIR)
postprocess:
@OUTPATH="$(IMAGEDIR)/$(IMAGE_OUTFILE)"; \
echo "** image: $$OUTPATH" >&2 && \
ln -sf "$(IMAGE_OUTFILE)" "$(IMAGEDIR)/$(IMAGE_LINK)" && \
ln -sf "$${IMAGEDIR#`pwd`/}" "$(OUT_LINK)"; \
ln -sf "$(IMAGE_LINK)" $(OUT_LINK)/"$(CURRENT_LINK).$(IMAGE_TYPE)"; \
if [ -n "$(GLOBAL_DEBUG)" ]; then \
cp -a build.log "$$OUTPATH.log"; \
cp -a distcfg.mk "$$OUTPATH.cfg"; \
fi
debug:
@echo "TOPDIR=$(TOPDIR)"
@echo "ARCH=$(ARCH)"
@echo "GLOBAL_HSH_APT_CONFIG=$(GLOBAL_HSH_APT_CONFIG)"
dot-disk:
@mkdir -p files/.disk
@echo "ALT Linux based" >files/.disk/info
@echo "$(ARCH)" >files/.disk/arch
@echo "$(DATE)" >files/.disk/date
@if type -t git >&/dev/null; then \
( cd $(TOPDIR) && \
git show-ref --head -ds -- HEAD ) \
>files/.disk/commit 2>/dev/null; \
fi

View File

@@ -1,12 +1,15 @@
Этот каталог копируется из метапрофиля в профиль "как есть"
и формирует "затравку", собирающую собственно образ из результатов
работы индивидуальных субпрофилей (см. ../sub.in/).
и формирует "затравку" финальной стадии, собирающей собственно
образ из результатов работы индивидуальных субпрофилей
(для distro/*) либо непосредственно "на месте" (для ve/*).
Содержимое files/ копируется в корень образа.
Соответственно для сборки требуется или features.in/build-distro,
или use/build-ve.
Пакетная база рабочего чрута минимальна; apt-utils включены
ради genbasedir, который после завершения первоначального
наполнения субпрофилей может переехать в ../sub.in/main/.
наполнения субпрофилей может переехать в ../sub.in/main/ (TODO).
Если требуется какая-либо иная обработка чрута, следует
предпочитать scripts.d/.

View File

@@ -1,4 +1,9 @@
PKGDIR=$(GLOBAL_BUILDDIR)/pkg
# globals
PKGDIR := $(GLOBAL_BUILDDIR)/pkg
### duplicated from toplevel build.mk, log.mk for sake of "local" builds
ARCH ?= $(shell arch | sed 's/i686/i586/')
DATE ?= $(shell date +%Y%m%d)
# prefix pkglist name with its directory to form a path
list = $(1:%=$(PKGDIR)/lists/%)
@@ -12,6 +17,7 @@ map = $(foreach a,$(2),$(call $(1),$(a)))
# kernel package list generation; see also #24669
NULL :=
SPACE := $(NULL) # the officially documented way of getting a space
list2re = $(subst $(SPACE),|,$(strip $(1)))
# args: KMODULES, KFLAVOURS
kpackages = ^kernel-(image|modules-($(call list2re,$(1))))-($(call list2re,$(2)))$$

0
image.in/image-scripts.d/.gitignore vendored Normal file
View File

0
image.in/lib/.gitignore vendored Normal file
View File

0
image.in/scripts.d/.gitignore vendored Normal file
View File

View File

@@ -1,14 +1,22 @@
# dump interesting variables' effective values;
# based on http://stackoverflow.com/questions/7117978
SPAM := $(.VARIABLES) DISTCFG_MK
# staged "uninteresting" lists
SPAM := SPAM INIT PREFS DISTCFG DISTCFG_MK
INIT := $(.VARIABLES)
-include $(HOME)/.mkimage/profiles.mk
PREFS := $(.VARIABLES)
-include distcfg.mk
HAM := $(.VARIABLES)
DISTCFG := $(.VARIABLES)
# a separator variable
-- := --
.PHONY: dump-vars
dump-vars:
$(foreach v, \
$(filter-out $(SPAM) SPAM,$(sort $(HAM))), \
$(filter-out $(SPAM) $(INIT),$(sort $(PREFS))) -- \
$(filter-out $(SPAM) $(PREFS),$(sort $(DISTCFG))), \
$(info $(v) = $($(v))))
@:

33
iso.mk
View File

@@ -1,33 +0,0 @@
# this makefile is designed to be included in toplevel one
ifndef BUILDDIR
$(error BUILDDIR not defined)
endif
export ARCH ?= $(shell arch | sed 's/i686/i586/')
# step 4 is kicked off here but actually done by image.in/Makefile
#
# adding boot/isolinux to prereqs is too late here,
# since profile/populate target is already done by now
#
# NB: /usr/bin/{i586,x86_64} are setarch(8) symlinks
iso:
@echo -n "** starting image build"
@if test -n "$(DEBUG)"; then \
echo ": tail -f $(BUILDLOG)" $(SHORTEN); \
else \
echo " (coffee time)"; \
fi
@if time -f "%E %PCPU %Mk" $(ARCH) \
$(MAKE) -C $(BUILDDIR)/ GLOBAL_BUILDDIR=$(BUILDDIR) $(LOG); \
then \
echo "** build done (`tail -1 $(BUILDLOG) | cut -f1 -d. \
|| echo "no log"`)"; \
else \
echo "** build failed, see log: $(BUILDLOG)" $(SHORTEN); \
if test -z "$(DEBUG)"; then \
echo " (you might want to re-run with DEBUG=1)"; \
fi; \
tail -100 "$(BUILDLOG)" | egrep "^E:|[Ee]rror|[Ww]arning"; \
fi

7
lib/README Normal file
View File

@@ -0,0 +1,7 @@
Этот каталог содержит вспомогательные makefiles,
обеспечивающие основную функциональность создания
конфигурации образа и генерации соответствующего
профиля для сборки; см. тж. ../conf.d/.
Следует помнить, что будучи включаемыми в ../Makefile,
они работают в каталоге верхнего уровня.

52
lib/build.mk Normal file
View File

@@ -0,0 +1,52 @@
# step 4 is kicked off here but actually done by image.in/Makefile
ifndef MKIMAGE_PROFILES
$(error this makefile is designed to be included in toplevel one)
endif
export ARCH ?= $(shell arch | sed 's/i686/i586/')
# try not to bog down the system, both CPU and I/O wise
ifdef NICE
START := nice $(shell ionice -c3 echo "ionice -c3" 2>/dev/null)
endif
# in kilobytes (a kilometer is 1024 meters, you know)
LOWSPACE = 1024
# it's also nice to know how long and much it takes
START += time -f "%E %PCPU %Mk"
# /usr/bin/{i586,x86_64} are setarch(8) symlinks
START += $(ARCH)
# to be passed into distcfg.mk
IMAGEDIR ?= $(shell [ -d "$$HOME/out" -a -w "$$HOME/out" ] \
&& echo "$$HOME/out" \
|| echo "$(BUILDDIR)/out" )
build: profile/populate
@echo -n "$(TIME) starting image build"
@if [ -n "$(DEBUG)" ]; then \
echo ": tail -f $(BUILDLOG)" $(SHORTEN); \
else \
if [ -n "$(ALL)" ]; then \
echo " [$(ALL)]"; \
else \
echo " (coffee time)"; \
fi; \
fi
@if $(START) $(MAKE) -C $(BUILDDIR)/ $(LOG); then \
echo "$(TIME) done (`tail -1 $(BUILDLOG) | cut -f1 -d.`)"; \
tail -200 "$(BUILDLOG)" \
| grep --color=always '^\*\* image: .*' $(SHORTEN) ||:; \
else \
echo "$(TIME) failed, see log: $(BUILDLOG)" $(SHORTEN); \
if [ -z "$(DEBUG)" ]; then \
echo "$(TIME) (you might want to re-run with DEBUG=1)"; \
fi; \
tail -200 "$(BUILDLOG)" | egrep "^(E:|[Ee]rror|[Ww]arning).*"; \
df -P $(BUILDDIR) | awk 'END { if ($$4 < $(LOWSPACE)) \
{ print "NB: low space on "$$6" ("$$5" used)"}}'; \
fi
@if [ -n "$(BELL)" ]; then echo -ne '\a' >&2; fi

View File

@@ -8,16 +8,17 @@
ifdef CLEAN
export GLOBAL_CLEAN_WORKDIR = clean-current
ifdef DEBUG
WARNING = (both CLEAN and DEBUG defined, debug options will be limited)
WARNING = (NB: DEBUG scope is limited when CLEAN is enabled)
endif
endif
# ordinary clean: destroys workdirs but not the corresponding results
clean:
@echo '** cleaning up $(WARNING)'
@find -name '*~' -delete >&/dev/null
@echo "$(TIME) cleaning up $(WARNING)"
@find -name '*~' -delete >&/dev/null ||:
@if [ -L build -a -d build/ ]; then \
$(MAKE) -C build $@ GLOBAL_BUILDDIR=$(shell readlink build) $(LOG); \
$(MAKE) -C build $@ \
GLOBAL_BUILDDIR=$(shell readlink build) $(LOG) ||:; \
fi
# there can be some sense in writing log here even if normally
@@ -26,7 +27,9 @@ clean:
distclean: clean
@if [ -L build -a -d build/ ]; then \
rm -rf build/.git; \
$(MAKE) -C build $@ GLOBAL_BUILDDIR=$(shell readlink build) $(LOG) && \
rm -r $(shell readlink build); \
$(MAKE) -C build $@ \
GLOBAL_BUILDDIR=$(shell readlink build) $(LOG) || \
rm -rf build/; \
rm -rf $(shell readlink build); \
fi
@rm -f build
@rm -f build ||:

37
lib/distro.mk Normal file
View File

@@ -0,0 +1,37 @@
# step 2: build up distribution's configuration
ifndef MKIMAGE_PROFILES
$(error this makefile is designed to be included in toplevel one)
endif
ifeq (distro,$(IMAGE_CLASS))
# request particular image subprofile inclusion
sub/%:
@$(call add,SUBPROFILES,$(@:sub/%=%))
# install media bootloader
boot/%: profile/bare use/syslinux
@$(call set,BOOTLOADER,$*)
# fundamental targets
distro/.init: profile/bare
# NB: the last flavour in KFLAVOURS gets to be the default one;
# the kernel packages regexp evaluation has to take place at build stage
distro/.base: distro/.init use/syslinux/localboot.cfg
@$(call set,KFLAVOURS,std-def)
# bootloader test target
distro/syslinux: distro/.init \
use/syslinux use/syslinux/localboot.cfg \
use/syslinux/ui-vesamenu use/hdt use/memtest
# 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
endif

View File

@@ -38,8 +38,13 @@ endef
# if the rule being executed isn't logged yet, log it
define log_body
{ grep -q '^# $@$$' "$(CONFIG)" || printf '# %s\n' '$@' >> "$(CONFIG)"; }
{ [ -s "$(CONFIG)" ] && \
grep -q '^# $@$$' "$(CONFIG)" || printf '# %s\n' '$@' >> "$(CONFIG)"; }
endef
# convert tag list into a list of relative package list paths
# NB: tags can do boolean expressions: (tag1 && !(tag2 || tag3))
tags = $(and $(strip $(1)),$(addprefix tagged/,$(shell echo "$(1)" | bin/tags2lists pkg.in/lists/tagged)))
# toplevel Makefile convenience
addsuffices = $(foreach s,$(1),$(call addsuffix,$s,$(2)))

View File

@@ -1,12 +1,11 @@
# this makefile is designed to be included in toplevel one
ifndef BUILDDIR
$(error BUILDDIR not defined)
endif
# simple logging switch inspired by netch@'s advice:
# you can add plain $(LOG) to a rule recipe line to moderate it
# (logfile is automatically truncated during profile/init)
ifndef MKIMAGE_PROFILES
$(error this makefile is designed to be included in toplevel one)
endif
BUILDLOG ?= $(BUILDDIR)/build.log
# LOG holds a postprocessor
@@ -23,6 +22,8 @@ MAKE += -s
LOG = 2>>$(BUILDLOG) >/dev/null
endif
# in build.mk, naive TIME gets expanded a bit too early (no need to export btw)
DATE = $(shell date +%Y%m%d)
TIME = `date +%H:%M:%S`
export BUILDLOG DATE DEBUG GLOBAL_DEBUG GLOBAL_VERBOSE LOG MAKE SHELL
export BUILDLOG DATE GLOBAL_DEBUG GLOBAL_VERBOSE LOG MAKE SHELL

108
lib/profile.mk Normal file
View File

@@ -0,0 +1,108 @@
ifndef MKIMAGE_PROFILES
$(error this makefile is designed to be included in toplevel one)
endif
SYMLINK = build
# this could have come from environment;
# if not, can be symlinked if r/w, or made anew
# NB: immediate assignment matters
# NB: PATH has no effect here
ifndef BUILDDIR
BUILDDIR := $(shell [ -s "$(SYMLINK)" ] \
&& realpath "$(SYMLINK)" \
|| bin/mktmpdir mkimage-profiles)
endif
# even smart caching only hurts when every build goes from scratch
NO_CACHE ?= 1
PATH := $(CURDIR)/bin:$(PATH)
export BUILDDIR NO_CACHE PATH
CONFIG := $(BUILDDIR)/distcfg.mk
RC := $(HOME)/.mkimage/profiles.mk
# holds a postprocessor; shell test executes in particular situation
# NB: not exported, for toplevel use only
SHORTEN = $(shell \
if [ -s "$(SYMLINK)" ]; then \
echo "| sed 's,$(BUILDDIR),$(SYMLINK),'"; \
else \
echo "| sed 's,$(TMP),\$$TMP,'"; \
fi;)
# step 1: initialize the off-tree mkimage profile (BUILDDIR)
profile/init: distclean
@echo -n "$(TIME) initializing BUILDDIR: "
@rsync -qaH --delete image.in/ "$(BUILDDIR)"/
@mkdir "$(BUILDDIR)"/.mki # mkimage toplevel marker
@$(call put,ifndef DISTCFG_MK)
@$(call put,DISTCFG_MK = 1)
@if type -t git >&/dev/null; then \
if [ -d .git ]; then \
git show-ref --head -d -s -- HEAD && \
git status -s && \
echo; \
fi $(LOG); \
fi
@{ \
eval `apt-config shell $${APTCONF:+-c=$(wildcard $(APTCONF))} \
SOURCELIST Dir::Etc::sourcelist/f \
SOURCEPARTS Dir::Etc::sourceparts/d`; \
find "$$SOURCEPARTS" -name '*.list' \
| xargs egrep -Rhv '^#|^[[:blank:]]*$$' "$$SOURCELIST" && \
echo; \
} $(LOG)
@if type -t git >&/dev/null; then \
if cd $(BUILDDIR); then \
git init -q && \
git add . && \
git commit -qam 'derivative profile initialized'; \
fi; \
fi
@if [ -w . ]; then \
rm -f "$(SYMLINK)" && \
ln -sf "$(BUILDDIR)" "$(SYMLINK)" && \
echo "$(SYMLINK)/"; \
else \
echo "$(BUILDDIR)/" $(SHORTEN); \
fi $(SHORTEN)
profile/bare: profile/init
@NOTE="$${GLOBAL_VERBOSE:+: $(CONFIG)}"; \
echo "$(TIME) preparing distro config$$NOTE" \
$(SHORTEN)
@$(call try,MKIMAGE_PREFIX,/usr/share/mkimage)
@$(call try,GLOBAL_VERBOSE,)
@$(call try,IMAGEDIR,$(IMAGEDIR))
@$(call try,BRANDING,altlinux-sisyphus)
@$(call set,IMAGE_INIT_LIST,+branding-$$(BRANDING)-release)
@if type -t git >&/dev/null && cd $(BUILDDIR); then \
git init -q && \
git add . && \
git commit -qam 'image configuration defaults set'; \
fi
profile/finalize:
@if [ -s $(RC) ]; then $(call put,-include $(RC)); fi
@$(call put,endif)
@if type -t git >&/dev/null && cd $(BUILDDIR); then \
git init -q && \
git add . && \
git commit -qam 'image configuration finalized'; \
fi
# requires already formed distcfg.mk for useful output
profile/dump-vars:
@if [ -s "$(SYMLINK)" ]; then \
$(MAKE) --no-print-directory -C "$(SYMLINK)/" -f vars.mk; \
echo; \
fi $(LOG)
# step 3 entry point: copy the needed parts into BUILDDIR
profile/populate: profile/init profile/finalize profile/dump-vars
@for dir in sub.in features.in pkg.in; do \
$(MAKE) -C $$dir $(LOG); \
done

15
lib/sugar.mk Normal file
View File

@@ -0,0 +1,15 @@
# this makefile contains some syntactic sugar for the toplevel one
# strip prefix
config/with/%: %; @:
# just map to specific features
config/like/%: use/build-%; @:
# map and preconfigure
config/pack/%: use/pack/%
@$(call set,IMAGE_TYPE,$*)
# just preconfigure
config/name/%:
@$(call set,IMAGE_NAME,$*)

19
lib/ve.mk Normal file
View File

@@ -0,0 +1,19 @@
# step 2: build up virtual environment's configuration
ifndef MKIMAGE_PROFILES
$(error this makefile is designed to be included in toplevel one)
endif
ifeq (ve,$(IMAGE_CLASS))
ve/.bare: profile/bare
@$(call add,BASE_PACKAGES,basesystem)
ve/generic: ve/.bare
@$(call add,BASE_LISTS,\
$(call tags,base && (server || network || security || pkg)))
ve/openvpn: ve/.bare
@$(call add,BASE_LISTS,$(call tags,server openvpn))
endif

View File

@@ -1,32 +0,0 @@
# low-level part of distro.mk
# request particular image subprofile inclusion
sub/%:
@$(call add,SUBPROFILES,$(@:sub/%=%))
# FIXME: maybe syslinux feature belongs to distro/.init?
boot/%: distro/.init use/syslinux
@$(call set,BOOTLOADER,$*)
# initalize config from scratch, put some sane defaults in
distro/.init:
@echo "** preparing distro configuration$${DEBUG:+: see $(CONFIG)}" $(SHORTEN)
@$(call try,MKIMAGE_PREFIX,/usr/share/mkimage)
@$(call try,GLOBAL_VERBOSE,)
@$(call try,IMAGEDIR,$(IMAGEDIR))
@$(call try,IMAGENAME,$(IMAGENAME))
distro/.branding: distro/.init
@$(call try,BRANDING,altlinux-sisyphus)
@$(call set,IMAGE_INIT_LIST,+branding-$$(BRANDING)-release)
# NB: the last flavour in KFLAVOURS gets to be the default one;
# the kernel packages regexp evaluation has to take place at build stage
distro/.base: distro/.branding sub/stage1 use/syslinux use/syslinux/localboot.cfg
@$(call set,KFLAVOURS,std-def)
# pick up release manager's config
distro/.rc:
@if [ -s $(HOME)/.mkimage/profiles.mk ]; then \
$(call put,-include $(HOME)/.mkimage/profiles.mk); \
fi

View File

@@ -13,11 +13,13 @@ all: $(GLOBAL_DEBUG)
@if [ -n "$(MAIN_GROUPS)" ]; then \
mkdir -p $(TARGET) && \
cp -at $(TARGET) -- $(addsuffix .directory,$(MAIN_GROUPS)); \
type -t git >&/dev/null && \
cd $(TARGET) && \
git add . && \
git commit -qam "requested $(SUFFIX) copied over"; \
cd - >&/dev/null; \
if type -t git >&/dev/null && cd $(TARGET); then \
if [ -n "`git status -s`" ]; then \
git add . && \
git commit -qam "requested $(SUFFIX) copied over"; \
fi; \
cd - >&/dev/null; \
fi; \
fi
debug:

View File

@@ -38,10 +38,12 @@ all: $(TARGET) $(GLOBAL_DEBUG)
@if [ -n "$(MAIN_GROUPS)" ]; then \
cp -at $(TARGET) -- $(MAIN_GROUPS); \
fi
@if type -t git >&/dev/null; then \
cd $(TARGET) && \
git add . && \
git commit -qam "requested $(SUFFIX) copied over"; \
@if type -t git >&/dev/null && cd $(TARGET); then \
if [ -n "`git status -s`" ]; then \
git add . && \
git commit -qam "requested $(SUFFIX) copied over"; \
fi; \
cd - >&/dev/null; \
fi
# do beforehand as foreach gets expanded before recipe execution

View File

@@ -0,0 +1,3 @@
rpm-build
mkimage
git-core

View File

@@ -1,4 +1,5 @@
wget
rsync
apt
vim-console
mc

View File

@@ -1,4 +1,4 @@
### Startup
# Startup
rootfiles
sysvinit
interactivesystem
@@ -7,7 +7,7 @@ startup-rescue
udev
### Common
# Common
coreutils
glibc-locales
glibc-nss
@@ -19,11 +19,11 @@ sysfsutils
sysklogd
util-linux
### CPU utils
# CPU utils
cpuburn
x86info
### Disk utils
# Disk utils
bonnie++
cfdisk
ddrescue
@@ -43,7 +43,7 @@ testdisk
mtools
partimage
### Applications
# Applications
binutils
dmidecode
hexedit
@@ -55,7 +55,7 @@ sharutils
time
openssl
### Applications/Archiving
# Applications/Archiving
arj
bzip2
gzip
@@ -63,16 +63,16 @@ unrar
unzip
zip
### Applications/Editors
# Applications/Editors
vim-console
### Applications/File
# Applications/File
findutils
file
less
mtools
### Filesystem utils
# Filesystem utils
dosfstools
e2fsprogs
jfsprogs
@@ -84,7 +84,7 @@ xfsprogs
btrfs-progs
ext3grep
### Applications/Networking
# Applications/Networking
arpwatch
elinks
hostinfo
@@ -113,7 +113,7 @@ traceroute
wget
whois
### Applications/Shells
# Applications/Shells
zsh
ash
bash
@@ -121,6 +121,6 @@ bc
gpm
mc
### Development/Debuggers
# Development/Debuggers
strace
sysstat

View File

@@ -1,3 +1,4 @@
sudo
su
passwd
syslogd

View File

@@ -0,0 +1,11 @@
apt
basesystem
sysklogd
etcnet
glibc-nss
openvpn
netlist
#alterator-fbi
openssh-server
passwd
less

View File

@@ -0,0 +1,5 @@
vim-console
screen
zsh
rsync
lftp

View File

@@ -1,68 +0,0 @@
# this makefile is designed to be included in toplevel one
SYMLINK = build
# this could have come from environment;
# if not, can be symlinked if r/w, or made anew
# NB: immediate assignment matters
# NB: PATH has no effect here
ifndef BUILDDIR
BUILDDIR := $(shell [ -s "$(SYMLINK)" ] \
&& realpath "$(SYMLINK)" \
|| bin/mktmpdir mkimage-profiles.build)
endif
# even smart caching only hurts when every build goes from scratch
NO_CACHE ?= 1
PATH := $(CURDIR)/bin:$(PATH)
export BUILDDIR NO_CACHE PATH
# holds a postprocessor; shell test executes in particular situation
# NB: not exported, for toplevel use only
SHORTEN = $(shell [ "$(DEBUG)" != 2 -a -s "$(SYMLINK)" ] \
&& echo "| sed 's,$(BUILDDIR),$(SYMLINK),'")
# step 1: initialize the off-tree mkimage profile (BUILDDIR)
profile/init: distclean
@echo -n "** initializing BUILDDIR: "
@rsync -qaH --delete image.in/ "$(BUILDDIR)"/
@{ \
echo "ifndef DISTCFG_MK"; \
echo "DISTCFG_MK = 1"; \
} > "$(BUILDDIR)"/distcfg.mk
@{ \
git show-ref --head -d -s -- HEAD && \
git status -s && \
echo; \
} $(LOG)
@mkdir "$(BUILDDIR)"/.mki # mkimage toplevel marker
@type -t git >&/dev/null && \
cd $(BUILDDIR) && \
git init -q && \
git add . && \
git commit -qam 'distribution profile initialized'
@rm -f "$(SYMLINK)" && \
if [ -w . ]; then \
ln -sf "$(BUILDDIR)" "$(SYMLINK)" && \
echo "$(SYMLINK)/"; \
else \
echo "$(BUILDDIR)/"; \
fi
profile/finalize: distro/.rc
@echo "endif" >> "$(BUILDDIR)"/distcfg.mk
# requires already formed distcfg.mk for useful output
profile/dump-vars:
@if [ -s "$(SYMLINK)" ]; then \
$(MAKE) --no-print-directory -C "$(SYMLINK)/" -f vars.mk; \
echo; \
fi $(LOG)
# step 3 entry point: copy the needed parts into BUILDDIR
profile/populate: profile/init profile/finalize profile/dump-vars
@for dir in sub.in features.in pkg.in; do \
$(MAKE) -C $$dir $(LOG); \
done

View File

@@ -13,12 +13,14 @@ all:
src="$${sub%/*}" && \
dst="$${sub#*/}" && \
neq="$${src#$$dst}" && \
rsync -a "$$src/" "$(BUILDDIR)/$$dst/" && \
type -t git >&/dev/null && \
cd "$(BUILDDIR)/$$dst/" && \
git add . && \
git commit -qam "$$dst subprofile initialized$${neq:+ (using $$src)}"; \
cd - >&/dev/null; \
rsync -qa "$$src/" "$(BUILDDIR)/$$dst/" && \
if type -t git >&/dev/null && cd "$(BUILDDIR)/$$dst/"; then \
if [ -n "`git status -s`" ]; then \
git add . && \
git commit -qam "$$dst subprofile initialized$${neq:+ (using $$src)}"; \
fi; \
cd - >&/dev/null; \
fi; \
done
clean:

View File

@@ -1,21 +1,21 @@
Этот каталог содержит субпрофили; содержимое затребованных
(названия которых содержатся в значении переменной SUBPROFILES,
которую заполняют цели sub/* -- см. ../distro.mk) будет
скопировано в каталог $(BUILDDIR)/image/ формируемого профиля.
которую заполняют цели sub/* -- см. ../lib/distro.mk) будет
скопировано в корневой каталог формируемого профиля.
Просьба ответственно относиться к модификации существующих
Просьба ответственно относиться к изменению существующих субпрофилей
и вдумчиво -- к созданию новых; возможно, достаточно всего лишь
оформить нужное новой фичей (см. ../features.in/).
Обратите внимание: поскольку сборка частей образа и происходит
в каталогах субпрофилей, то повторное использование одного простого
субпрофиля в рамках сгенерированного профиля штатным образом невозможно.
Если требуется создать несколько близких по реализации субпрофилей,
изучите stage2 и задействующие его фичи.
Обратите внимание: поскольку сборка частей дистрибутивного образа
и происходит в каталогах субпрофилей, то повторное использование
одного простого субпрофиля в рамках сгенерированного профиля штатным
образом невозможно. Если требуется создать несколько близких по
реализации субпрофилей, изучите stage2 и задействующие его фичи.
Краткое описание существующих вариантов:
- stage1: propagator и загрузчик (при подключении фичи syslinux);
- stage1: propagator и загрузчик (совместно с фичей syslinux);
типично требуется для инсталяторов, live- и rescue-образов,
но может использоваться без добавления таковых в образ,
обеспечивая сетевую загрузку второй стадии

View File

@@ -1,5 +1,7 @@
Этот каталог содержит субпрофиль main, собирающий пакетную базу
для локальной инсталяции системы и возможности установки дополнений.
для локальной инсталяции дистрибутива из полученного образа,
включая необязательные пакеты; в live-builder применяется как
локальный репозиторий для сборки.
Подбирает:
- SYSTEM_PACKAGES, COMMON_PACKAGES, BASE_PACKAGES, BASE_LISTS:

View File

@@ -13,6 +13,8 @@
STAGE1_KMODULES_REGEXP -- будет подмножество модулей
из kernel-image (упаковываются в syslinux/alt0/full.cz).
Требуется для инсталяционных, live- и rescue-образов.
Требуется для инсталяционных, live- и rescue-образов,
соответствующими фичами подключается автоматически
(в силу зависимости stage2 от stage1).
Результат -- каталог syslinux/ для копирования в образ.

View File

@@ -26,7 +26,7 @@ IMAGE_PACKAGES += $(SYSTEM_PACKAGES)
# no kernel flavour specified will result in no modules for stage1 vmlinuz
STAGE1_KFLAVOUR ?= $(lastword $(KFLAVOURS))
ifeq "$(STAGE1_KFLAVOUR)" ""
ifeq (,$(STAGE1_KFLAVOUR))
$(error STAGE1_KFLAVOUR is utterly empty; cannot guess either)
endif
@@ -43,4 +43,4 @@ all: | $(GLOBAL_DEBUG) build-image run-image-scripts pack-image \
$(GLOBAL_CLEAN_WORKDIR)
# dummy
debug: ;
debug:: ;

Some files were not shown because too many files have changed in this diff Show More