Compare commits

..

13 Commits

Author SHA1 Message Date
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
39 changed files with 381 additions and 148 deletions

View File

@@ -0,0 +1,62 @@
Name: mkimage-profiles
Version: 0.4.2
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
* 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

@@ -20,13 +20,18 @@ IMAGE_TYPE := $(IMAGE_TYPE:.%=%)# iso
# most of the actual work done elsewhere
include lib/*.mk
include conf.d/*.mk
include features.in/*/config.mk
DISTRO_TARGETS := $(shell sed -n 's,^\(distro/[^:.]\+\):.*$$,\1,p' \
lib/distro.mk $(wildcard conf.d/*.mk) | sort)
VE_TARGETS := $(shell sed -n 's,^\(ve/[^:.]\+\):.*$$,\1,p' \
lib/ve.mk $(wildcard conf.d/*.mk) | sort)
DISTROS := $(call addsuffices,$(DISTRO_EXTS),$(DISTRO_TARGETS))
VES := $(call addsuffices,$(VE_EXTS),$(VE_TARGETS))
IMAGES := $(DISTROS) $(VES)
.PHONY: $(IMAGES)
.PHONY: $(IMAGES) $(DISTRO_TARGETS) $(VE_TARGETS)
help:
@echo '** available distribution targets:'

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:-`realpath ..`}"
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,^\./,,'

17
conf.d/README Normal file
View File

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

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

@@ -0,0 +1,13 @@
# desktop distributions
ifeq (distro,$(IMAGE_CLASS))
distro/desktop-base: distro/installer sub/main \
use/syslinux/ui-vesamenu use/x11/xorg use/bootloader/grub
distro/icewm: distro/desktop-base \
use/lowmem use/x11/xdm use/x11/runlevel5 \
use/bootloader/lilo use/powerbutton/acpi \
use/cleanup/alterator
@$(call add,BASE_LISTS,$(call tags,icewm desktop))
endif

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

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

@@ -8,3 +8,6 @@
# spares tmpfs, quite recommended unless you need raw workdir chroots
#CLEAN = 1
# try and draw attention when done (depends on readline/terminal settings)
#BELL = 1

View File

@@ -6,13 +6,17 @@
- APTCONF
+ задаёт путь к требуемому apt.conf
+ значение: пусто (по умолчанию системный) либо строка
+ см. ../image.in/Makefile
+ см. ../image.in/Makefile, apt.conf.sample
- ARCH
+ определяет целевую архитектуру образа
+ значение: пусто (по умолчанию авто), i586 или x86_64
+ см. ../lib/build.mk
- BELL
+ требует подачу сигнала после завершения сборки
+ см. ../lib/build.mk
- BUILDDIR
+ определяет каталог генерируемого профиля и сборки
+ значение: пусто (по умолчанию авто) либо строка

View File

@@ -27,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 \
@@ -34,12 +35,23 @@ 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; \
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 \
@@ -47,33 +59,39 @@ all:
rsync -qab "$$dir/" "$$destdir/"; \
fi; \
if [ -d "tagged/$$dir" ]; then \
pushd "tagged/$$dir" && \
echo "$$feat && ($$src || $$dst)" \
| tags2lists . \
| xargs -r cp -v -pLt "$$destdir" --; \
popd; \
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

View File

@@ -40,7 +40,7 @@ dot-disk:
@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 ) \
( cd $(TOPDIR) && test -d .git && \
git show-ref --head -ds -- HEAD ||:) \
>files/.disk/commit 2>/dev/null; \
fi

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

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

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

@@ -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,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,3 +1,3 @@
ui gfxboot bootlogo
ui gfxboot bootlogo message
menu title mkimage-profiles 2.0
prompt 0

View File

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

View File

@@ -1,6 +1,7 @@
# stage 4: dive into mkimage
GLOBAL_BUILDDIR ?= $(shell pwd)
LINKPREFIX := mkimage-profiles
include distcfg.mk
include functions.mk
@@ -39,7 +40,8 @@ postprocess:
@OUTPATH="$(IMAGEDIR)/$(IMAGE_OUTFILE)"; \
echo "** image: $(IMAGE_OUTFILE)" && \
ln -sf "$(IMAGE_OUTFILE)" "$(IMAGEDIR)/$(IMAGE_FILE)" && \
ln -sf "$(IMAGE_FILE)" "$(IMAGEDIR)/mkimage-profiles.$(IMAGE_TYPE)"; \
ln -sf "$(IMAGE_FILE)" "$(IMAGEDIR)/$(LINKPREFIX).$(IMAGE_TYPE)"; \
ln -sf "$${OUTPATH#`pwd`/}" "$(IMAGE_FILE)"; \
if [ -n "$(GLOBAL_DEBUG)" ]; then \
cp -a build.log "$$OUTPATH.log"; \
cp -a distcfg.mk "$$OUTPATH.cfg"; \

View File

@@ -1,5 +1,8 @@
# 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

View File

@@ -34,3 +34,4 @@ build: profile/populate
df -P $(BUILDDIR) | awk 'END { if ($$4 < 1024) \
{ print "** NB: low space on "$$6" ("$$5" used)"}}'; \
fi
@if [ -n "$(BELL)" ]; then echo -ne '\a' >&2; fi

View File

@@ -15,7 +15,7 @@ endif
# ordinary clean: destroys workdirs but not the corresponding results
clean:
@echo '** cleaning up $(WARNING)'
@find -name '*~' -delete >&/dev/null
@find -name '*~' -delete >&/dev/null ||:
@if [ -L build -a -d build/ ]; then \
$(MAKE) -C build $@ GLOBAL_BUILDDIR=$(shell readlink build) $(LOG) ||:; \
fi
@@ -28,6 +28,6 @@ distclean: clean
rm -rf build/.git; \
$(MAKE) -C build $@ GLOBAL_BUILDDIR=$(shell readlink build) $(LOG) || \
rm -rf build/; \
rm -r $(shell readlink build); \
rm -rf $(shell readlink build); \
fi
@rm -f build
@rm -f build ||:

View File

@@ -4,15 +4,8 @@ ifndef MKIMAGE_PROFILES
$(error this makefile is designed to be included in toplevel one)
endif
# NB: distro/ targets should be defined in this file
DISTRO_TARGETS := $(shell sed -n 's,^\(distro/[^:.]\+\):.*$$,\1,p' \
$(lastword $(MAKEFILE_LIST)) | sort)
ifeq (distro,$(IMAGE_CLASS))
.PHONY: $(DISTRO_TARGETS)
# request particular image subprofile inclusion
sub/%:
@$(call add,SUBPROFILES,$(@:sub/%=%))
@@ -35,63 +28,10 @@ distro/syslinux: distro/.init \
use/syslinux use/syslinux/localboot.cfg \
use/syslinux/ui-vesamenu use/hdt use/memtest
# live images
distro/live: distro/.base use/live use/syslinux/ui-menu
distro/rescue: distro/.base use/rescue use/syslinux/ui-menu
distro/dos: distro/.init use/dos use/syslinux/ui-menu
# $(VAR) will be substituted before writing them to $(CONFIG);
# $$(VAR) will remain unsubstituted until $(CONFIG) is included
# and their value requested (so the variable referenced
# can change its value during configuration _before_
# it's actually used); just peek inside $(CONFIG) ;-)
# BASE_PACKAGES, BASE_LISTS, MAIN_PACKAGES, MAIN_LISTS: see sub.in/main/
# something actually useful (as a network-only installer)
# something marginally useful (as a network-only installer)
# NB: doesn't carry stage3 thus cannot use/bootloader
distro/installer: distro/.base use/install2
@$(call set,INSTALLER,altlinux-generic)
@$(call set,STAGE1_KMODULES_REGEXP,drm.*) # for KMS
# server distributions
distro/server-base: distro/installer sub/main \
use/syslinux/ui-menu use/memtest use/bootloader/grub
@$(call add,BASE_LISTS,server-base)
distro/server-mini: distro/server-base use/cleanup/x11-alterator
@$(call set,KFLAVOURS,el-smp)
@$(call add,KMODULES,e1000e igb)
@$(call add,BASE_LISTS,\
$(call tags,base && (server || network || security || pkg)))
@$(call add,BASE_LISTS,$(call tags,extra network))
distro/server-ovz: distro/server-base \
use/hdt use/rescue use/firmware/server use/powerbutton/acpi \
use/cleanup/x11-alterator
@$(call set,STAGE1_KFLAVOUR,std-def)
@$(call set,KFLAVOURS,std-def ovz-el)
@$(call add,KMODULES,bcmwl e1000e igb ndiswrapper rtl8168 rtl8192)
@$(call add,KMODULES,ipset ipt-netflow opendpi pf_ring xtables-addons)
@$(call add,KMODULES,drbd83 kvm)
@$(call add,BASE_LISTS,ovz-server)
@$(call add,BASE_LISTS,$(call tags,base server))
@$(call add,MAIN_LISTS,kernel-wifi)
@$(call add,MAIN_GROUPS,dns-server http-server ftp-server kvm-server)
@$(call add,MAIN_GROUPS,ipmi mysql-server dhcp-server mail-server)
@$(call add,MAIN_GROUPS,monitoring diag-tools)
# desktop distributions
distro/desktop-base: distro/installer sub/main \
use/syslinux/ui-vesamenu use/x11/xorg use/bootloader/grub
distro/icewm: distro/desktop-base \
use/lowmem use/x11/xdm use/x11/runlevel5 \
use/bootloader/lilo use/powerbutton/acpi \
use/cleanup/alterator
@$(call add,BASE_LISTS,$(call tags,icewm desktop))
# NB: if there are too many screens above, it might make sense to distro.d/
endif

View File

@@ -11,7 +11,7 @@ SYMLINK = build
ifndef BUILDDIR
BUILDDIR := $(shell [ -s "$(SYMLINK)" ] \
&& realpath "$(SYMLINK)" \
|| bin/mktmpdir mkimage-profiles.build)
|| bin/mktmpdir mkimage-profiles)
endif
# even smart caching only hurts when every build goes from scratch
@@ -26,45 +26,62 @@ RC := $(HOME)/.mkimage/profiles.mk
# 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),'")
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 "** initializing BUILDDIR: "
@rsync -qaH --delete image.in/ "$(BUILDDIR)"/
@mkdir "$(BUILDDIR)"/.mki # mkimage toplevel marker
@$(call put,ifndef DISTCFG_MK)
@$(call put,DISTCFG_MK = 1)
@{ \
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
@if type -t git >&/dev/null; then \
if [ -d .git ]; then \
git show-ref --head -d -s -- HEAD && \
git status -s && \
echo; \
fi $(LOG); \
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
@echo "** preparing distro configuration$${DEBUG:+: see $(CONFIG)}" $(SHORTEN)
@echo "** preparing distro config$${DEBUG:+: see $(CONFIG)}" \
$(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:

View File

@@ -4,14 +4,8 @@ ifndef MKIMAGE_PROFILES
$(error this makefile is designed to be included in toplevel one)
endif
# NB: ve/ targets should be defined in this file
VE_TARGETS := $(shell sed -n 's,^\(ve/[^:.]\+\):.*$$,\1,p' \
$(lastword $(MAKEFILE_LIST)) | sort)
ifeq (ve,$(IMAGE_CLASS))
.PHONY: $(VE_TARGETS)
ve/.bare: profile/bare
@$(call add,BASE_PACKAGES,basesystem)
@@ -22,5 +16,4 @@ ve/generic: ve/.bare
ve/openvpn: ve/.bare
@$(call add,BASE_LISTS,$(call tags,server openvpn))
# NB: if there are too many screens above, it might make sense to ve.d/
endif

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

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

@@ -43,4 +43,4 @@ all: | $(GLOBAL_DEBUG) build-image run-image-scripts pack-image \
$(GLOBAL_CLEAN_WORKDIR)
# dummy
debug: ;
debug:: ;

View File

@@ -4,3 +4,5 @@
Результат -- соответственно названный файл со squashfs,
подлежащий копированию в итоговый образ.
NB: смонтированный образ доступен в такой системе как /image/.