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)
This commit is contained in:
parent
b6438b9c8f
commit
83392012d4
@ -1,8 +1,19 @@
|
||||
# live images
|
||||
ifeq (distro,$(IMAGE_CLASS))
|
||||
|
||||
distro/live: distro/.base use/live use/syslinux/ui-menu
|
||||
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,apt-repo zsh)
|
||||
@$(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)
|
||||
|
||||
endif
|
||||
|
@ -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
|
@ -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
|
||||
|
||||
|
@ -41,7 +41,7 @@ postprocess:
|
||||
echo "** image: $(IMAGE_OUTFILE)" && \
|
||||
ln -sf "$(IMAGE_OUTFILE)" "$(IMAGEDIR)/$(IMAGE_FILE)" && \
|
||||
ln -sf "$(IMAGE_FILE)" "$(IMAGEDIR)/$(LINKPREFIX).$(IMAGE_TYPE)"; \
|
||||
ln -sf "$$OUTPATH" "$(IMAGE_FILE)"; \
|
||||
ln -sf "$${OUTPATH#`pwd`/}" "$(IMAGE_FILE)"; \
|
||||
if [ -n "$(GLOBAL_DEBUG)" ]; then \
|
||||
cp -a build.log "$$OUTPATH.log"; \
|
||||
cp -a distcfg.mk "$$OUTPATH.cfg"; \
|
||||
|
@ -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 ||:
|
||||
|
@ -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,36 +26,43 @@ 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)
|
||||
@{ \
|
||||
@if type -t git >&/dev/null; then \
|
||||
if [ -d .git ]; then \
|
||||
git show-ref --head -d -s -- HEAD && \
|
||||
git status -s && \
|
||||
echo; \
|
||||
} $(LOG)
|
||||
@mkdir "$(BUILDDIR)"/.mki # mkimage toplevel marker
|
||||
@if type -t git >&/dev/null && cd $(BUILDDIR); then \
|
||||
fi $(LOG); \
|
||||
if cd $(BUILDDIR); then \
|
||||
git init -q && \
|
||||
git add . && \
|
||||
git commit -qam 'derivative profile initialized'; \
|
||||
fi; \
|
||||
fi
|
||||
@rm -f "$(SYMLINK)" && \
|
||||
if [ -w . ]; then \
|
||||
@if [ -w . ]; then \
|
||||
rm -f "$(SYMLINK)" && \
|
||||
ln -sf "$(BUILDDIR)" "$(SYMLINK)" && \
|
||||
echo "$(SYMLINK)/"; \
|
||||
else \
|
||||
echo "$(BUILDDIR)/"; \
|
||||
fi
|
||||
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))
|
||||
|
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
|
||||
|
@ -4,3 +4,5 @@
|
||||
|
||||
Результат -- соответственно названный файл со squashfs,
|
||||
подлежащий копированию в итоговый образ.
|
||||
|
||||
NB: смонтированный образ доступен в такой системе как /image/.
|
||||
|
Loading…
Reference in New Issue
Block a user