forked from altcloud/mkimage-profiles
Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
67a7f68e79 | ||
|
83392012d4 | ||
|
b6438b9c8f | ||
|
08de714970 | ||
|
895fae7d82 | ||
|
e8306860f1 | ||
|
6a280d758d | ||
|
912d86c4af | ||
|
812883facc | ||
|
ace2ee1fc1 | ||
|
0a8490ad7f | ||
|
77115ff50b | ||
|
7919df829c |
62
.gear/mkimage-profiles.spec
Normal file
62
.gear/mkimage-profiles.spec
Normal 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
2
.gear/rules
Normal file
@@ -0,0 +1,2 @@
|
||||
spec: .gear/mkimage-profiles.spec
|
||||
tar: v@version@:.
|
7
Makefile
7
Makefile
@@ -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:'
|
||||
|
@@ -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 ..`}"
|
||||
|
@@ -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
17
conf.d/README
Normal 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
13
conf.d/desktop.mk
Normal 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
21
conf.d/live.mk
Normal 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
30
conf.d/server.mk
Normal 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
8
doc/apt.conf.sample
Normal 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";
|
@@ -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
|
||||
|
@@ -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
|
||||
+ определяет каталог генерируемого профиля и сборки
|
||||
+ значение: пусто (по умолчанию авто) либо строка
|
||||
|
@@ -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
|
||||
|
@@ -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
5
features.in/dev/README
Normal file
@@ -0,0 +1,5 @@
|
||||
Эта фича служит для создания образов, предназначающихся для разработки.
|
||||
В первую очередь обеспечивается развёртывание hasher и mkimage.
|
||||
|
||||
Реализована поддержка LiveCD, возможно приспособление для образов
|
||||
сборочных VM/VE.
|
7
features.in/dev/config.mk
Normal file
7
features.in/dev/config.mk
Normal 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)
|
44
features.in/dev/live/image-scripts.d/40-hasher
Executable file
44
features.in/dev/live/image-scripts.d/40-hasher
Executable 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"
|
7
features.in/dev/live/image-scripts.d/50-etcnet-dhcp
Executable file
7
features.in/dev/live/image-scripts.d/50-etcnet-dhcp
Executable 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 ||:
|
9
features.in/dev/live/image-scripts.d/80-cdrom-repo
Executable file
9
features.in/dev/live/image-scripts.d/80-cdrom-repo
Executable 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
|
@@ -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)"
|
||||
|
@@ -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)))
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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)"
|
||||
|
@@ -1,3 +1,3 @@
|
||||
ui gfxboot bootlogo
|
||||
ui gfxboot bootlogo message
|
||||
menu title mkimage-profiles 2.0
|
||||
prompt 0
|
||||
|
3
features.in/syslinux/cfg.in/10removable.cfg
Normal file
3
features.in/syslinux/cfg.in/10removable.cfg
Normal file
@@ -0,0 +1,3 @@
|
||||
label removable
|
||||
menu label Boot from ^removable drive
|
||||
localboot 0x00
|
@@ -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"; \
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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 ||:
|
||||
|
@@ -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
|
||||
|
@@ -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:
|
||||
|
@@ -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
|
||||
|
@@ -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:
|
||||
|
@@ -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
|
||||
|
3
pkg.in/lists/tagged/base+builder
Normal file
3
pkg.in/lists/tagged/base+builder
Normal file
@@ -0,0 +1,3 @@
|
||||
rpm-build
|
||||
mkimage
|
||||
git-core
|
@@ -1,4 +1,5 @@
|
||||
wget
|
||||
rsync
|
||||
apt
|
||||
vim-console
|
||||
mc
|
||||
|
@@ -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:
|
||||
|
@@ -43,4 +43,4 @@ all: | $(GLOBAL_DEBUG) build-image run-image-scripts pack-image \
|
||||
$(GLOBAL_CLEAN_WORKDIR)
|
||||
|
||||
# dummy
|
||||
debug: ;
|
||||
debug:: ;
|
||||
|
@@ -4,3 +4,5 @@
|
||||
|
||||
Результат -- соответственно названный файл со squashfs,
|
||||
подлежащий копированию в итоговый образ.
|
||||
|
||||
NB: смонтированный образ доступен в такой системе как /image/.
|
||||
|
Reference in New Issue
Block a user