Commit d91a3564 authored by Michael Shigorin's avatar Michael Shigorin

working installer iso image

- s/stage2/install2/g - added pkg/lists - initial README (ru_RU.KOI8-R) - mkimage topdir is in image.in/, really (off-tree build) + initial bin/mktmpdir + BUILDDIR (works) - s/cd/iso/ - drop --with-distro (considered harmful)
parent 8dc5159e
this directory marks profile topdir, see mkimage README
......@@ -5,3 +5,14 @@
include clean.mk
include distro.mk
include iso.mk
# we can't use implicit rules for top-level targets, only for prereqs
CONFIGS=$(shell sed -n 's,^distro/\([^:]\+\):.*$$,\1,p' distro.mk)
DISTROS=$(addsuffix .iso,$(CONFIGS))
all:
@echo '** available distribution targets:'
@echo $(DISTROS) | fmt -sw65 | column -t
$(DISTROS): %.iso: | prep distro/% iso
Объекты:
- дистрибутивы: distro.mk, могут основываться один на другом;
желательно избегать множественного наследования, используя
вместо него блоки use-*
- блоки функциональности use-*: не являются самостоятельными
(не путать с дистрибутивами), но законченными
- субпрофили:
+ install2: инсталятор
+ main: пакетная база к инсталяции (обязательная и дополнительная)
+ ...
- списки пакетов: большая человеческая просьба по возможности
избегать дублирования
#!/bin/sh
# analyze free space, preferring tmpfs over really many gigaz
# hope there aren't spaces in RM's $HOME are they?
DIRS="$TMP $TMPDIR $HOME/hasher /tmp /var/tmp"
MINSIZE=1048576 # face control criterion
# pick existing, writeable, >1Gb free space dirs
# rank them wrt type: tmpfs > realfs > rootfs
choose_tmpdir() {
for i in $DIRS; do
[ -d "$i" -a -w "$i" ] || continue
echo -n "$i "
df -Tl "$i" | tail -1
done \
| sort -unk6 \
| while read dir dev fstype size used free percent mnt; do
[ "$free" -gt "$MINSIZE" ] || continue
[ "$fstype" = "tmpfs" ] && { echo "2 $dir $free"; continue; }
[ "$mnt" = "/" ] && { echo "0 $dir $free"; continue; }
echo "1 $dir $free"
done \
| sort -n \
| tail -1 \
| cut -f2 -d' '
}
DIR="`choose_tmpdir`"
mktemp -d "${1:-tmpdir}.XXXXXXXXXX" --tmpdir="${DIR:-..}"
clean distclean:
@find -type f -name .config -delete 2>/dev/null ||:
make -C image $@
clean:
@echo '** cleaning up...'
@[ -d build/ ] && \
make -C build $@ GLOBAL_BUILDDIR=$(shell readlink build) \
||:
distclean: clean
@[ -d build/ ] && \
make -C build $@ GLOBAL_BUILDDIR=$(shell readlink build) && \
rm -r $(shell readlink build) && \
rm .config.mk build \
||:
# it can be symlinked if r/w (see configure);
# if not, then should come from environment
#BUILDDIR ?= $(shell realpath build)
BUILDDIR ?= $(shell realpath build)
prep:
@echo BUILDDIR: $(BUILDDIR)
#!/bin/sh
# this is a chinese configure script:
# it would take any parameters,
# nod the head intelligently,
# and hide 'em beneath the clothes
# (until time comes)
PARAMS="$@"
# TODO: grep/validate?
# create suitable temporary directory for this build, then
# copy profiles there to configure a copy, not master tree
# keeping profile itself completely readonly would be nice
export BUILDDIR="$(bin/mktmpdir mkimage-profiles.build)"
ls -ld $BUILDDIR
#find image.in -type f -print0 | xargs -r0 cp -at "$BUILDDIR"/ --
rsync -qa --delete image.in/ "$BUILDDIR"/
cp -a pkg "$BUILDDIR"/
#rm -f "$BUILDDIR"/.config.mk
touch "$BUILDDIR"/.config.mk
mkdir "$BUILDDIR"/.mki
rm -f build
[ -w . ] \
&& ln -sf "$BUILDDIR" build \
|| echo "profile directory readonly: skipping symlinks, env only"
# remember all those --with-*? we'll pass them downstream, honestly
echo "$PARAMS" > "$BUILDDIR"/.with
### build up distribution's configuration
CONFIG = $(BUILDDIR)/.config.mk
# ACHTUNG: don"t use ANY quotes ('/") for put() arguments!
# shell will get confused by ' or args get spammed with "
put = $(and $(1),$(put_body))
define put_body
@printf '%s\n' '$(1)# $@' >> "$(CONFIG)";
endef
# request particular image subprofile inclusion
sub/%:
echo SUBDIRS+=$(@:sub/%=%) >> .config
$(call put,SUBPROFILES+=$(@:sub/%=%))
init:
:> .config
@echo "** starting distro configuration build process"
:> $(CONFIG)
$(call put,KFLAVOUR=std-def)
$(call put,IMAGE_INIT_LIST=+branding-$$(BRANDING)-release)
$(call put,STAGE1_PACKAGES=kernel-image-$$(KFLAVOUR))
# NB: our */* are phony targets really, just for namespace
distro/installer: init sub/install2
@#$(call put,BRANDING=altlinux-sisyphus) ###
$(call put,BASE_LISTS=base kernel)
$(call put,INSTALL2_PACKAGES=kernel-image-$$(KFLAVOUR))
distro/bare: init sub/install2
echo BASE_LISTS='base kernel' >> .config
distro/server-base: distro/installer sub/main use/memtest86
$(call put,BRANDING=altlinux-backup-server) ###
$(call put,BASE_LISTS+=server-base kernel-server)
distro/server-base: distro/bare sub/main
echo BASE_LISTS+='server-base kernel-server' >> .config
@#echo DISTRO_TRACE+=$@ >> .config
distro/server-light: distro/server-base
$(call put,KFLAVOUR=ovz-smp)
$(call put,BRANDING=sisyphus-server-light)
$(call put,DISK_LISTS+=kernel-wifi)
distro/server-light: distro/server-base sub/disk
echo BASE_LISTS+='kernel-wifi' >> .config
@#echo DISTRO_TRACE+=$@ >> .config
use/memtest86:
$(call put,COMMON_PACKAGES+=memtest86+)
@# configure syslinux/isolinux as well
include globals.mk
include functions.mk
include $(MKIMAGE_PREFIX)/config.mk
include $(GLOBAL_BUILDDIR)/.config.mk
SUBDIRS = $(SUBPROFILES)
# we usually need a bootloader (until stage1 is separate),
# and "main" subprofile needs genbasedir
CHROOT_PACKAGES = syslinux apt-utils $(STAGE1_PACKAGES)
###
MKI_PACK_RESULTS = boot:mkimage-profiles.iso
COPY_TREE = ./isodata
BOOT_TYPE = isolinux
###
PROPAGATOR_VERSION = mkimage-profiles 2.0
PROPAGATOR_MAR_MODULES = ./modules
PROPAGATOR_INITFS = ./initfs
include /usr/share/mkimage/targets.mk
all: prep copy-tree copy-subdirs run-scripts pack-image
prep: initfs disk-info metadata
@echo "TOPDIR=$(TOPDIR)"
initfs:
echo "file /.VERSION @TMPDIR@/.VERSION 0644 0 0" >initfs
### FIXME: broken test, we already do branding
[ -z "$(BRANDING)" ] || \
echo "file /bootsplash /bootsplash/bootsplash 0644 0 0" >>initfs
disk-info:
mkdir -p isodata/.disk
echo "$(PROPAGATOR_VERSION)" >isodata/.disk/info ### +$(ARCH)
(cd $(TOPDIR); git show-ref --head --dereference -s -- HEAD 2>/dev/null) >isodata/.disk/commit
[ -s isodata/.disk/commit ] || rm isodata/.disk/commit
# see also alterator-pkg (backend3/pkg-install)
# FIXME: groups unmerged
metadata:
mkdir -p isodata/Metadata
rm -f isodata/Metadata/pkg-groups.tar
tar -cvf isodata/Metadata/pkg-groups.tar \
-C $(PKGDIR) \
$(shell echo $(call list,.base) $(call list,base) | sed 's,$(PKGDIR)/*,,g')
......@@ -16,44 +16,24 @@ AC_ARG_WITH(aptconf,
APTCONF=/etc/apt/apt.conf
])
AC_ARG_WITH(distro,
AC_HELP_STRING([--with-distro=distro],
[base distro, e.g '--with-distro=desktop' (implies branding/docs)]),
[
if test -n "$with_distro" ; then
# conditional distro config file inclusion?
DISTRO="$with_distro"
case "$DISTRO" in
desktop*)
LABEL="Desktop"
;;
server-light)
# TODO: docs, kernel...
LABEL="Server"
;;
# TODO: default case
esac
# FIXME: branding
fi
AC_MSG_RESULT([** distro: $DISTRO])
])
AC_ARG_WITH(mkimage,
AC_HELP_STRING([--with-mkimage=dir],
[custom mkimage prefix, e.g '--with-mkimage=/home/me/mkimage']),
[
AC_MSG_CHECKING([mkimage])
if test -d "$with_mkimage/usr/share/mkimage"; then
MKI_PREFIX="$with_mkimage"
MKIMAGE_PREFIX="$with_mkimage"
AC_MSG_RESULT([** $with_mkimage/usr/share/mkimage exists])
fi
],
[
MKI_PREFIX=''
MKIMAGE_PREFIX=''
])
# with-kernel: provide two separate desktop/server default substs?
AC_SUBST(APTCONF)
AC_SUBST(MKI_PREFIX)
AC_SUBST(MKIMAGE_PREFIX)
AC_SUBST(DISTRO)
AC_SUBST(LABEL)
......
PKGDIR=$(TOPDIR)/pkg
# prefix pkglist name with its directory to form a path
list = $(1:%=$(PKGDIR)/lists/%)
export
MKIMAGE_PREFIX=@MKIMAGE_PREFIX@
GLOBAL_HSH_APT_CONFIG=@APTCONF@
GLOBAL_VERBOSE=0
default: all
include $(GLOBAL_BUILDDIR)/globals.mk
include $(GLOBAL_BUILDDIR)/functions.mk
include $(MKIMAGE_PREFIX)/config.mk
include $(GLOBAL_BUILDDIR)/.config.mk
IMAGE_PACKAGES = kernel-image-std-def \
installer-distro-server-light-stage2 \
./packages \
$(INSTALL2_PACKAGES)
MKI_PACK_RESULTS = squash:altinst
include $(MKIMAGE_PREFIX)/targets.mk
all: build-image run-image-scripts pack-image
udev
e2fsprogs
glibc-nss
......@@ -10,7 +10,7 @@ implicit 1
# localboot 0x80
label linux
kernel alt0/vmlinuz
append initrd=alt0/full.cz changedisk vga=0x314 quiet=1 showopts automatic=metod:cdrom
append initrd=alt0/full.cz changedisk vga=0x314 quiet=1 showopts automatic=method:cdrom
label noapic
kernel alt0/vmlinuz
append initrd=alt0/full.cz changedisk vga=0x314 showopts nolapic noapic acpi=off
......
### installation package base (requisite + optional)
default: all
include $(GLOBAL_BUILDDIR)/globals.mk
include $(GLOBAL_BUILDDIR)/functions.mk
include $(MKIMAGE_PREFIX)/config.mk
include $(GLOBAL_BUILDDIR)/.config.mk
CHROOT_PACKAGES = apt-utils rsync
PACKAGES_EXPAND_METHOD=regexp
IMAGE_PACKAGES = $(call list,.base) \
$(MAIN_PACKAGES) \
$(call list,$(BASE_LISTS)) \
$(call list,$(DISK_LISTS))
MKI_DESTDIR = ALTLinux/RPMS.main
MKI_PACK_RESULTS = data
include $(MKIMAGE_PREFIX)/targets.mk
# TODO: pkg groups
all: debug copy-packages pack-image
debug:
@echo "IMAGE_PACKAGES: $(IMAGE_PACKAGES)"
#!/bin/sh
verbose()
{
[ -z "$GLOBAL_VERBOSE" ] ||
echo >&2 "HOOK: 01-genbasedir: $*"
}
verbose started
[ -d "$WORKDIR/ALTLinux" ] || exit 0
cd "$WORKDIR/ALTLinux"
set -- contrib-main addon-main ltsp-main
for pair; do
slave=${pair%-*}
master=${pair#*-}
verbose "slave=$slave master=$master"
[ -d "RPMS.$master" ] || continue
find "RPMS.$master" -mindepth 1 -maxdepth 1 -type f -name '*.rpm' -printf "RPMS.$slave/%f\\0" |
xargs -r0 rm -fv --
done
#We always put RPMS.addon on separate disk
if [ -d RPMS.addon ] ; then
rm -fr RPMS.main
INFO_LABEL="Addon"
fi
comps="$(find -mindepth 1 -maxdepth 1 -type d -name 'RPMS.*' -printf '%f\n' |
sed 's/^RPMS\.//')"
verbose "comps=$comps"
genbasedir \
--topdir="$WORKDIR" \
--architecture="$INFO_ARCH" \
--no-oldhashfile \
--partial \
--bz2only \
--create \
--notautomatic=false \
${INFO_NAME:+--archive="$INFO_NAME"} \
${INFO_VERSION:+--version="$INFO_VERSION"} \
${INFO_ORIGIN:+--origin="$INFO_ORIGIN"} \
${INFO_LABEL:+--label="$INFO_LABEL"} \
ALTLinux $comps
verbose finished
include /usr/share/mkimage/config.mk
SUBDIRS = stage2
CHROOT_PACKAGES = kernel-image-un-def apt-utils
MKI_PACK_RESULTS = boot:mkimage-profiles.iso
COPY_TREE = ./isodata
BOOT_TYPE = isolinux
PROPAGATOR_VERSION = mkimage-profiles 2.0
PROPAGATOR_MAR_MODULES = ./modules
PROPAGATOR_INITFS = ./initfs
include /usr/share/mkimage/targets.mk
all: initfs copy-tree copy-subdirs run-scripts pack-image
initfs:
echo "file /.VERSION @TMPDIR@/.VERSION 0644 0 0" > initfs
#[ -z "$(BRANDING)" ] || \
# echo "file /bootsplash /bootsplash/bootsplash 0644 0 0" >> initfs
# prefix pkglist name with its directory to form a path
#list = $(1:%=$(GLOBAL_PKGDIR)/lists/%)
list = $(1:%=pkg/lists/%)
file /.VERSION @TMPDIR@/.VERSION 0644 0 0
include /usr/share/mkimage/config.mk
GLOBAL_VERBOSE=1
#CHROOT_PACKAGES=kernel-image-un-def
CHROOT_PACKAGES = kernel-image-un-def apt-utils
#SUBDIR = /boot
MKI_IMAGESUBDIR = /boot
MKI_PACK_RESULTS = data
PROPAGATOR_VERSION = mkimage-profiles 2.0
PROPAGATOR_MAR_MODULES = ./modules
PROPAGATOR_INITFS = ./initfs
include /usr/share/mkimage/targets.mk
#all: build-propagator pack-image
all: build-propagator
CONFIGDIR = /usr/share/mkimage
include $(CONFIGDIR)/config.mk
IMAGE_PACKAGES = kernel-image-un-def \
udev \
e2fsprogs \
glibc-nss \
installer-distro-server-light-stage2
MKI_PACK_RESULTS = squash:altinst
#MKI_PACK_RESULTS = squash:live
include $(CONFIGDIR)/targets.mk
all: build-image run-image-scripts pack-image
cd:
# setup GLOBAL_BOOT_TYPE, etc
make -C image
# check iso size
iso:
@echo "** starting image build process"
@### setup GLOBAL_BOOT_TYPE, etc
i586 make -C $(BUILDDIR) GLOBAL_BUILDDIR=$(BUILDDIR)
@# check iso size
basesystem
kernel-image-std-def
interactivesystem
apt-conf-sisyphus
apt
alterator-lilo
alterator-root
alterator-users
alterator-net-eth
interactivesystem
apt-conf-sisyphus
apt
alterator-lilo
kernel-image-std-def
kernel-modules-igb-std-def
interactivesystem
vim-console
sfdisk
mdadm
openssh-server
acpid
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment