Commit 42242fd3 authored by Anton Midyukov's avatar Anton Midyukov

e2k, install2, live, live-install, rescue: generate menu when generate profile

This allows us to add menu items to the menu that cannot be specified based on the external features of the files contained in the image. For example, the item 'live' of boot in rescue mode. In the future, it will be possible to remake generators for syslinux and grub using a similar principle.
parent d5feb0c7
label=@label@
partition=0
image=/boot/image.0
cmdline=console=ttyS0,115200 console=tty0 hardreset fastboot live lowmem @initrd_typeargs@=method:cdrom @stage2@ @stage2_bootargs@ @lang@
initrd=/boot/initrd.img
label=@label@_flash
partition=0
image=/boot/image.0
cmdline=console=ttyS0,115200 console=tty0 hardreset fastboot live lowmem @initrd_typeargs@=method:disk,label:altinst @stage2@ @stage2_bootargs@ @lang@
initrd=/boot/initrd.img
# USB Flash note: write the contents including .disk/ onto
# an ext2 formatted drive with "altinst" filesystem label
default=@default@
timeout=@timeout@
ifneq (,$(BUILDDIR))
# prepare boot.conf
include $(BUILDDIR)/distcfg.mk
DSTDIR := $(BUILDDIR)/stage1/files
RESULTCFG := $(DSTDIR)/boot.conf
all: debug prep config timeout
# integerity check
timeout: config
@TIMEOUT=3; \
sed -i "s,@timeout@,$$TIMEOUT," $(RESULTCFG)
config: prep
@mv $(DSTDIR)/head.conf $(RESULTCFG); \
DEFAULT=""; \
MENU_ITEMS=""; \
[ -n "$(STAGE2_ALTINST)" ] && [ "$(STAGE2_LIVE_INST)" ] && \
echo "Error: STAGE2_ALTINST and STAGE2_LIVE_INST is set!!!" >&2 && exit 1; \
[ -n "$(STAGE2_RESCUE)" ] && [ "$(STAGE2_LIVE_RESCUE)" ] && \
echo "Error: STAGE2_RESCUE and STAGE2_LIVE_RESCUE is set!!!" >&2 && exit 1; \
[ -z "$(STAGE2_ALTINST)" ] || MENU_ITEMS="altinst"; \
[ -z "$(STAGE2_LIVE_INST)" ] || MENU_ITEMS="$$MENU_ITEMS liveinst"; \
[ -z "$(STAGE2_LIVE)" ] || MENU_ITEMS="$$MENU_ITEMS live"; \
[ -z "$(STAGE2_LIVE_RESCUE)" ] || MENU_ITEMS="$$MENU_ITEMS liverescue"; \
[ -z "$(STAGE2_RESCUE)" ] || MENU_ITEMS="$$MENU_ITEMS rescue"; \
for i in $$MENU_ITEMS; do \
if [ "$$i" = altinst ]; then \
LABEL="install"; \
STAGE2="stagename=altinst"; \
INIT=""; \
elif [ "$$i" = liveinst ]; then \
LABEL="install"; \
STAGE2="stagename=live"; \
INIT=" init=/usr/sbin/install2-init"; \
elif [ "$$i" = liverescue ]; then \
LABEL=rescue; \
STAGE2="stagename=live"; \
INIT=" systemd.unit=live-rescue.target"; \
else \
LABEL="$$i"; \
STAGE2="stagename=$$i"; \
INIT=""; \
fi; \
[ -n "$$DEFAULT" ] || DEFAULT="$$LABEL"; \
cat $(DSTDIR)/body.conf | sed -e "s,@stage2@,$$STAGE2$$INIT," -e "s,@label@,$$LABEL," >> $(RESULTCFG); \
done; \
sed -i "s,@default@,$$DEFAULT," $(RESULTCFG); \
sed -i "s,@lang@,lang=$(LOCALE)," $(RESULTCFG); \
sed -i "s;@initrd_typeargs@;$(STAGE1_INITRD_TYPEARGS);" $(RESULTCFG); \
sed -i "s;@stage2_bootargs@;$(STAGE2_BOOTARGS);" $(RESULTCFG); \
rm -f $(DSTDIR)/{body,head}.conf
clean:
@rm -f $(RESULTCFG)
prep:
@mkdir -p $(DSTDIR)
@cp cfg.in/{body,head}.conf $(DSTDIR)/
debug:
@if [ -n "$(DEBUG)" ]; then \
[ -z "$(STAGE2_ALTINST)" ] || echo "** STAGE2_ALTINST: $(STAGE2_ALTINST)"; \
[ -z "$(STAGE2_LIVE)" ] || echo "** LIVE: $(STAGE2_LIVE)"; \
[ -z "$(STAGE2_LIVE_INST)" ] || echo "** LIVE_INST: $(STAGE2_LIVE_INST)"; \
[ -z "$(STAGE2_LIVE_RESCUE)" ] || echo "** LIVE_RESCUE: $(STAGE2_LIVE_RESCUE)"; \
[ -z "$(STAGE2_RESCUE)" ] || echo "** RESCUE: $(STAGE2_RESCUE)"; \
fi
endif
#!/bin/sh
echo "** 20-e2k-boot START"
cd "$WORKDIR"
# slightly different logic as there's no boot *menu*:
# ensure the user can install this if possible
[ -f live ] && default=live
[ -f rescue ] && default=rescue
[ -f altinst ] && default=install
[ -f live ] && [ ! -f altinst ] && [ -f Metadata/pkg-groups.tar ] && default=install
cat > boot.conf << EOF
# USB Flash note: write the contents including .disk/ onto
# an ext2 formatted drive with "altinst" filesystem label
default=$default
timeout=3
EOF
for i in live altinst liveinst rescue; do
if [ "$i" = liveinst ]; then
[ -f live ] || continue
[ ! -f altinst ] || continue
[ -f Metadata/pkg-groups.tar ] || continue
else
[ -f "$i" ] || continue
fi
case "$i" in
altinst)
label=install
stage2=
;;
liveinst)
label=install
stage2="stagename=live"
init="init=/usr/sbin/install2-init"
;;
*)
label="$i"
stage2="stagename=$i"
;;
esac
cat >> boot.conf << EOF
label=$label
partition=0
image=/boot/image.0
cmdline=console=ttyS0,115200 console=tty0 hardreset fastboot live ${GLOBAL_STAGE1_INITRD_TYPEARGS:-automatic}=method:cdrom ${stage2:+$stage2 }${init:+$init }${GLOBAL_STAGE2_BOOTARGS:+$GLOBAL_STAGE2_BOOTARGS }${GLOBAL_BOOT_LANG:+lang=$GLOBAL_BOOT_LANG}
initrd=/boot/initrd.img
label=${label}_flash
partition=0
image=/boot/image.0
cmdline=console=ttyS0,115200 console=tty0 hardreset fastboot live lowmem ${GLOBAL_STAGE1_INITRD_TYPEARGS:-automatic}=method:disk,label:altinst ${stage2:+$stage2 }${init:+$init }${GLOBAL_STAGE2_BOOTARGS:+$GLOBAL_STAGE2_BOOTARGS }${GLOBAL_BOOT_LANG:+lang=$GLOBAL_BOOT_LANG}
initrd=/boot/initrd.img
EOF
done
ls -lh
echo "** 20-e2k-boot END"
......@@ -6,6 +6,7 @@ use/install2: use/stage2 sub/stage2@install2 use/metadata \
use/cleanup/installer use/install2/autoinstall \
use/syslinux/install2.cfg use/grub/install2.cfg
@$(call add_feature)
@$(call set,STAGE2_ALTINST,yes)
@$(call add,INSTALL2_PACKAGES,installer-common-stage2)
@$(call try,INSTALLER,regular) # might be replaced later
@$(call add,INSTALL2_PACKAGES,installer-distro-$$(INSTALLER)-stage2)
......
......@@ -7,6 +7,7 @@ use/live-install: use/live use/metadata use/repo/main \
use/bootloader use/grub/live-install.cfg use/syslinux/live-install.cfg \
use/alternatives/xvt/xterm
@$(call add_feature)
@$(call set,STAGE2_LIVE_INST,yes)
@$(call add,LIVE_PACKAGES,installer-common-stage2)
@$(call add,THE_PACKAGES,alterator-wizardface)
@$(call add,THE_LISTS,$(call tags,basesystem && !alterator))
......
......@@ -31,6 +31,7 @@ use/live/no-cleanup: \
use/live/base: use/live/.base use/net use/deflogin/live \
use/syslinux/live.cfg use/grub/live.cfg
@$(call set,STAGE2_LIVE,yes)
@$(call add,LIVE_LISTS,$(call tags,base network))
use/live/rw: use/live use/syslinux/live_rw.cfg use/grub/live_rw.cfg; @:
......@@ -99,6 +100,7 @@ endif
# live as Rescue
use/live/rescue: use/live use/grub/live-rescue.cfg use/syslinux/live-rescue.cfg
@$(call set,STAGE2_LIVE_RESCUE,yes)
@$(call add,LIVE_PACKAGES,livecd-rescue-utility)
@$(call add,LIVE_LISTS,tagged/base+rescue)
ifeq (,$(filter-out x86_64,$(ARCH)))
......
use/rescue/.base: use/stage2 sub/stage2@rescue \
use/syslinux/rescue.cfg use/grub/rescue.cfg
@$(call add_feature)
@$(call set,STAGE2_RESCUE,yes)
@$(call add,RESCUE_LISTS,sysvinit)
@$(call add,RESCUE_PACKAGES,startup startup-rescue udev)
@$(call add,RESCUE_LISTS,openssh)
......
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